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

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

h = A("h")
i = B("i")
a = A("a")
l = A("l")
j = A("j")
e = B("e")
k = A("k")
m = A("m")
d = B("d")
c = B("c")

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

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

h = A("h")
i = B("i")
a = A("a")
l = A("l")
j = A("j")
e = B("e")
k = A("k")
m = A("m")
d = B("d")
c = B("c")

h.u = e
i.o = a
i.u = l
a.u = c
l.u = e
j.u = e
e.o = a
e.u = h
k.u = d
m.u = e
d.o = j
d.u = j
c.o = h
c.u = k
assert h.u.u.u.u.u.txt == "e"