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

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

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

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

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

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

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