class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: D = None
        self.o: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: E = None
        self.t: E = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: E = None
        self.x: E = None
        self.q: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.p: B = None
        self.x: F = None
        self.w: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: A = None
        self.x: E = None
        self.r: E = None
        self.u: F = None
        self.z: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: D = None
        self.txt = txt

a = A("a")
m = B("m")
f = C("f")
c = D("c")
b = E("b")
i = F("i")
j = E("j")
g = C("g")

a.w = m
a.t = c
a.o = i
m.r = c
m.s = b
m.t = j
m.z = a
f.r = c
f.y = j
f.x = b
f.q = b
c.u = a
c.p = m
c.x = i
c.w = g
b.t = f
b.o = a
b.x = j
b.r = j
b.z = j
b.u = i
i.w = m
i.u = c
j.t = f
j.o = a
j.x = b
j.r = b
j.z = b
j.u = i
g.r = c
g.y = j
g.x = j
g.q = j
assert c.w.r.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: D = None
        self.o: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: E = None
        self.t: E = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: E = None
        self.x: E = None
        self.q: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.p: B = None
        self.x: F = None
        self.w: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: A = None
        self.x: E = None
        self.r: E = None
        self.u: F = None
        self.z: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: D = None
        self.txt = txt

a = A("a")
m = B("m")
f = C("f")
c = D("c")
b = E("b")
i = F("i")
j = E("j")
g = C("g")

a.w = m
a.t = c
a.o = i
m.r = c
m.s = b
m.t = j
m.z = a
f.r = c
f.y = j
f.x = b
f.q = b
c.u = a
c.p = m
c.x = i
c.w = g
b.t = f
b.o = a
b.x = j
b.r = j
b.z = j
b.u = i
i.w = m
i.u = c
j.t = f
j.o = a
j.x = b
j.r = b
j.z = b
j.u = i
g.r = c
g.y = j
g.x = j
g.q = j
assert c.w.r.p.z.txt == "a"