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

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

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

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

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

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

j.u = d
j.t = c
l.t = d
l.u = c
a.u = j
a.t = h
b.t = j
b.u = c
h.t = j
h.u = b
f.t = i
f.u = h
i.u = d
i.t = b
d.u = i
d.t = b
c.t = a
c.u = b
assert d.t.u.t.u.u.t.t.u.u.txt == "i"