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

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

e = A("e")
h = B("h")
j = B("j")
c = B("c")
l = B("l")
b = A("b")
n = A("n")
i = B("i")
f = A("f")

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

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

e = A("e")
h = B("h")
j = B("j")
c = B("c")
l = B("l")
b = A("b")
n = A("n")
i = B("i")
f = A("f")

e.u = f
h.t = n
h.u = f
j.t = e
j.u = f
c.t = f
c.u = e
l.t = f
l.u = n
b.u = f
n.u = e
i.t = b
i.u = f
f.u = e
assert l.u.u.u.u.u.u.u.u.txt == "e"