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

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

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

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

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

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

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