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

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

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

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

f = A("f")
e = B("e")
g = C("g")
k = D("k")
m = C("m")
l = B("l")
c = C("c")

f.t = c
f.u = c
f.z = g
f.w = e
e.x = f
e.o = l
g.z = c
k.w = f
m.z = c
l.x = f
l.o = e
c.z = m
assert c.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: C = None
        self.w: B = None
        self.u: C = None
        self.txt = txt

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

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

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

f = A("f")
e = B("e")
g = C("g")
k = D("k")
m = C("m")
l = B("l")
c = C("c")

f.t = c
f.u = c
f.z = g
f.w = e
e.x = f
e.o = l
g.z = c
k.w = f
m.z = c
l.x = f
l.o = e
c.z = m
assert c.z.z.z.txt == "m"