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

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

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

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

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

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

a.u = n
a.o = b
b.r = m
e.u = n
e.o = m
k.u = b
k.o = n
l.u = c
l.o = n
i.u = m
i.o = n
m.r = n
n.r = m
c.r = n
assert a.o.r.r.r.r.txt == "n"