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

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

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

g = A("g")
f = B("f")
l = C("l")
e = B("e")
k = A("k")
n = B("n")
j = A("j")
h = C("h")
m = C("m")
i = B("i")

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

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

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

g = A("g")
f = B("f")
l = C("l")
e = B("e")
k = A("k")
n = B("n")
j = A("j")
h = C("h")
m = C("m")
i = B("i")

g.t = i
f.p = j
l.z = n
e.p = g
k.t = n
n.p = k
j.t = e
h.z = f
m.z = f
i.p = j
assert f.p.t.p.t.txt == "i"