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

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

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

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

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

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

m.u = l
m.t = i
f.v = l
l.v = f
i.u = k
i.t = m
k.v = f
e.v = l
b.v = k
assert m.u.v.v.v.v.txt == "l"