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

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

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

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

i = A("i")
f = B("f")
k = C("k")
e = D("e")
a = C("a")
h = D("h")
b = C("b")

i.z = f
i.t = f
i.o = a
f.w = h
f.u = b
k.o = e
e.u = b
a.o = e
h.u = a
b.o = h
assert b.o.u.o.u.o.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: B = None
        self.o: C = None
        self.txt = txt

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

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

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

i = A("i")
f = B("f")
k = C("k")
e = D("e")
a = C("a")
h = D("h")
b = C("b")

i.z = f
i.t = f
i.o = a
f.w = h
f.u = b
k.o = e
e.u = b
a.o = e
h.u = a
b.o = h
assert b.o.u.o.u.o.u.o.txt == "e"