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

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

l = A("l")
e = B("e")
k = B("k")
n = A("n")
h = B("h")
c = B("c")
m = A("m")

l.u = n
e.x = h
e.p = n
k.x = h
k.p = n
n.u = m
h.x = c
h.p = n
c.x = e
c.p = n
m.u = n
assert n.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

l = A("l")
e = B("e")
k = B("k")
n = A("n")
h = B("h")
c = B("c")
m = A("m")

l.u = n
e.x = h
e.p = n
k.x = h
k.p = n
n.u = m
h.x = c
h.p = n
c.x = e
c.p = n
m.u = n
assert n.u.u.u.u.u.u.txt == "n"