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

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

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

a = A("a")
d = B("d")
l = C("l")
g = B("g")
e = B("e")

a.t = l
a.z = l
d.u = l
l.y = a
l.u = d
g.u = l
e.u = l
assert d.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: C = None
        self.txt = txt

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

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

a = A("a")
d = B("d")
l = C("l")
g = B("g")
e = B("e")

a.t = l
a.z = l
d.u = l
l.y = a
l.u = d
g.u = l
e.u = l
assert d.u.u.u.u.txt == "d"