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

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

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

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

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

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

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