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

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

a = A("a")
l = B("l")
j = B("j")
k = B("k")
i = B("i")
b = A("b")
d = B("d")
m = B("m")
h = B("h")
f = B("f")

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

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

a = A("a")
l = B("l")
j = B("j")
k = B("k")
i = B("i")
b = A("b")
d = B("d")
m = B("m")
h = B("h")
f = B("f")

a.u = i
a.o = l
l.t = a
l.x = i
j.t = a
j.x = i
k.t = a
k.x = h
i.t = a
i.x = d
b.u = j
b.o = h
d.t = a
d.x = l
m.t = a
m.x = i
h.t = a
h.x = j
f.t = a
f.x = h
assert l.t.o.t.o.txt == "l"