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

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

j = A("j")
a = B("a")
e = B("e")
h = A("h")
l = B("l")
b = B("b")
i = B("i")
g = A("g")

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

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

j = A("j")
a = B("a")
e = B("e")
h = A("h")
l = B("l")
b = B("b")
i = B("i")
g = A("g")

j.o = h
j.u = h
a.o = e
e.o = l
h.o = j
h.u = g
l.o = e
b.o = a
i.o = a
g.o = j
g.u = j
assert j.u.u.o.u.o.txt == "j"