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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

d = A("d")
b = B("b")
g = C("g")
k = D("k")
c = E("c")
f = C("f")

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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

d = A("d")
b = B("b")
g = C("g")
k = D("k")
c = E("c")
f = C("f")

d.q = k
d.z = k
d.t = c
d.x = g
b.t = d
b.y = k
b.z = c
g.w = k
k.s = b
k.z = c
k.u = g
c.o = b
f.w = k
assert d.t.o.y.u.w.s.txt == "b"