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

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

i = A("i")
m = B("m")
h = A("h")
e = B("e")
l = A("l")

i.o = e
i.u = m
m.r = l
m.t = i
h.o = e
h.u = m
e.r = l
e.t = i
l.o = e
l.u = e
assert h.o.t.o.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: B = None
        self.txt = txt

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

i = A("i")
m = B("m")
h = A("h")
e = B("e")
l = A("l")

i.o = e
i.u = m
m.r = l
m.t = i
h.o = e
h.u = m
e.r = l
e.t = i
l.o = e
l.u = e
assert h.o.t.o.t.o.txt == "e"