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

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

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

k = A("k")
n = B("n")
d = C("d")
f = B("f")
h = A("h")
j = B("j")
c = C("c")
b = A("b")

k.z = b
n.q = d
d.t = h
d.r = j
d.u = b
f.q = d
h.z = b
j.q = c
c.t = h
c.r = f
c.u = k
b.z = h
assert h.z.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.q: C = None
        self.txt = txt

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

k = A("k")
n = B("n")
d = C("d")
f = B("f")
h = A("h")
j = B("j")
c = C("c")
b = A("b")

k.z = b
n.q = d
d.t = h
d.r = j
d.u = b
f.q = d
h.z = b
j.q = c
c.t = h
c.r = f
c.u = k
b.z = h
assert h.z.z.z.z.z.z.z.z.txt == "h"