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.txt = txt

n = A("n")
a = B("a")
l = B("l")

n.u = l
a.t = n
l.t = n
assert l.t.u.t.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.txt = txt

n = A("n")
a = B("a")
l = B("l")

n.u = l
a.t = n
l.t = n
assert l.t.u.t.txt == "n"