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

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

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

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

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

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

k.u = a
f.t = i
f.x = i
b.u = a
m.t = k
m.x = k
l.t = k
l.x = k
i.u = a
a.t = k
a.x = b
assert i.u.t.u.x.u.x.u.txt == "a"