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

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

c = A("c")
e = B("e")
b = B("b")
j = A("j")
h = B("h")
m = A("m")

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

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

c = A("c")
e = B("e")
b = B("b")
j = A("j")
h = B("h")
m = A("m")

c.o = h
c.u = j
e.u = c
e.t = b
b.u = m
b.t = e
j.o = h
j.u = m
h.u = c
h.t = e
m.o = b
m.u = j
assert e.t.t.u.o.t.t.txt == "b"