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

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

b = A("b")
a = B("a")
k = A("k")
n = B("n")
f = A("f")
l = B("l")

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

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

b = A("b")
a = B("a")
k = A("k")
n = B("n")
f = A("f")
l = B("l")

b.u = k
b.w = l
a.t = k
k.u = f
k.w = n
n.t = f
f.u = b
f.w = n
l.t = b
assert a.t.w.t.u.u.w.txt == "n"