class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.p: B = None
        self.r: B = None
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: A = None
        self.txt = txt

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

f = A("f")
e = B("e")
c = C("c")
h = D("h")
d = C("d")

f.t = e
f.p = e
f.r = e
f.u = e
e.z = f
c.p = d
c.y = f
h.o = c
h.w = c
h.s = e
d.p = c
d.y = f
assert c.y.t.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.p: B = None
        self.r: B = None
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: A = None
        self.txt = txt

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

f = A("f")
e = B("e")
c = C("c")
h = D("h")
d = C("d")

f.t = e
f.p = e
f.r = e
f.u = e
e.z = f
c.p = d
c.y = f
h.o = c
h.w = c
h.s = e
d.p = c
d.y = f
assert c.y.t.z.u.txt == "e"