class A:
    def __init__(self, txt: str):
        self.z: A = 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.y: C = None
        self.r: A = None
        self.p: C = None
        self.txt = txt

e = A("e")
m = B("m")
l = C("l")
g = B("g")
c = C("c")
n = A("n")
k = A("k")
b = A("b")
h = B("h")
j = C("j")

e.z = k
m.z = g
l.y = j
l.r = k
l.p = c
g.z = m
c.y = j
c.p = j
c.r = e
n.z = k
k.z = b
b.z = e
h.z = g
j.y = l
j.p = l
j.r = e
assert e.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.z: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: A = None
        self.p: C = None
        self.txt = txt

e = A("e")
m = B("m")
l = C("l")
g = B("g")
c = C("c")
n = A("n")
k = A("k")
b = A("b")
h = B("h")
j = C("j")

e.z = k
m.z = g
l.y = j
l.r = k
l.p = c
g.z = m
c.y = j
c.p = j
c.r = e
n.z = k
k.z = b
b.z = e
h.z = g
j.y = l
j.p = l
j.r = e
assert e.z.z.z.z.z.z.z.txt == "k"