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

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

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

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

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

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

j.u = b
j.t = b
n.o = l
b.u = l
b.t = l
l.u = b
l.t = j
g.o = j
i.o = j
e.o = b
assert l.t.u.u.u.t.txt == "l"