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

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

l = A("l")
j = B("j")
h = B("h")
g = B("g")
i = A("i")
d = A("d")
k = B("k")
b = B("b")
m = A("m")
c = B("c")

l.t = i
l.z = i
j.u = k
h.u = g
g.u = c
i.t = d
i.z = m
d.t = l
d.z = l
k.u = b
b.u = j
m.t = i
m.z = l
c.u = k
assert j.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: A = None
        self.txt = txt

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

l = A("l")
j = B("j")
h = B("h")
g = B("g")
i = A("i")
d = A("d")
k = B("k")
b = B("b")
m = A("m")
c = B("c")

l.t = i
l.z = i
j.u = k
h.u = g
g.u = c
i.t = d
i.z = m
d.t = l
d.z = l
k.u = b
b.u = j
m.t = i
m.z = l
c.u = k
assert j.u.u.u.u.u.u.txt == "j"