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

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

k = A("k")
b = B("b")
l = B("l")

k.o = b
b.u = k
l.u = k
assert l.u.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

k = A("k")
b = B("b")
l = B("l")

k.o = b
b.u = k
l.u = k
assert l.u.o.u.txt == "k"