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

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

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

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

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

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

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