class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.x: B = None
        self.w: D = None
        self.z: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: D = None
        self.x: C = None
        self.v: D = None
        self.p: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: D = None
        self.txt = txt

k = A("k")
g = B("g")
h = C("h")
b = D("b")
i = E("i")
c = F("c")
m = C("m")
d = D("d")

k.t = h
k.x = g
k.w = b
k.z = i
g.x = h
h.u = g
h.p = b
b.o = g
b.z = g
b.s = g
b.t = g
i.z = k
i.y = b
i.x = h
i.p = h
i.v = d
c.x = k
c.y = b
m.u = g
m.p = d
d.o = g
d.z = g
d.s = g
d.t = g
assert k.w.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.x: B = None
        self.w: D = None
        self.z: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: D = None
        self.x: C = None
        self.v: D = None
        self.p: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: D = None
        self.txt = txt

k = A("k")
g = B("g")
h = C("h")
b = D("b")
i = E("i")
c = F("c")
m = C("m")
d = D("d")

k.t = h
k.x = g
k.w = b
k.z = i
g.x = h
h.u = g
h.p = b
b.o = g
b.z = g
b.s = g
b.t = g
i.z = k
i.y = b
i.x = h
i.p = h
i.v = d
c.x = k
c.y = b
m.u = g
m.p = d
d.o = g
d.z = g
d.s = g
d.t = g
assert k.w.s.x.txt == "h"