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

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

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

g = A("g")
i = B("i")
k = C("k")
c = C("c")
j = B("j")
h = C("h")
e = C("e")
n = C("n")

g.z = i
i.z = j
k.t = j
c.t = i
j.z = i
h.t = i
e.t = j
n.t = j
assert k.t.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

g = A("g")
i = B("i")
k = C("k")
c = C("c")
j = B("j")
h = C("h")
e = C("e")
n = C("n")

g.z = i
i.z = j
k.t = j
c.t = i
j.z = i
h.t = i
e.t = j
n.t = j
assert k.t.z.z.z.z.z.z.txt == "j"