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

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

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

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

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

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

l.z = m
a.u = m
a.t = f
k.u = m
k.t = m
d.u = k
d.t = b
b.u = f
b.t = d
m.u = b
m.t = h
h.u = f
h.t = a
f.u = d
f.t = k
assert l.z.u.u.t.u.txt == "m"