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

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

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

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

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

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

c.o = m
j.u = i
b.u = j
e.u = m
k.o = m
n.u = i
g.o = n
i.u = m
m.u = j
assert c.o.u.u.u.u.u.txt == "i"