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

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

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

d = A("d")
n = B("n")
a = C("a")
l = A("l")
k = C("k")
e = C("e")
f = C("f")
h = C("h")

d.z = l
n.t = l
n.u = f
a.t = d
l.z = d
k.t = l
e.t = d
f.t = d
h.t = d
assert f.t.z.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

d = A("d")
n = B("n")
a = C("a")
l = A("l")
k = C("k")
e = C("e")
f = C("f")
h = C("h")

d.z = l
n.t = l
n.u = f
a.t = d
l.z = d
k.t = l
e.t = d
f.t = d
h.t = d
assert f.t.z.z.z.z.z.z.z.txt == "l"