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

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

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

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

k.p = j
j.p = e
f.z = j
l.p = e
b.p = j
c.z = j
g.p = j
n.p = j
a.z = j
e.p = j
assert j.p.p.p.p.p.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

k.p = j
j.p = e
f.z = j
l.p = e
b.p = j
c.z = j
g.p = j
n.p = j
a.z = j
e.p = j
assert j.p.p.p.p.p.p.p.p.txt == "j"