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

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

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

e = A("e")
d = B("d")
c = C("c")
n = C("n")
g = B("g")
b = C("b")
j = C("j")
f = C("f")
a = C("a")
l = A("l")

e.q = a
d.u = g
d.t = e
c.z = b
n.z = a
g.u = d
g.t = e
b.z = n
j.z = f
f.z = c
a.z = f
l.q = a
assert n.z.z.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

e = A("e")
d = B("d")
c = C("c")
n = C("n")
g = B("g")
b = C("b")
j = C("j")
f = C("f")
a = C("a")
l = A("l")

e.q = a
d.u = g
d.t = e
c.z = b
n.z = a
g.u = d
g.t = e
b.z = n
j.z = f
f.z = c
a.z = f
l.q = a
assert n.z.z.z.z.z.z.z.z.txt == "c"