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

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

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

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

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

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

l.t = c
c.o = l
k.o = l
assert l.t.o.t.txt == "c"