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

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

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

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

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

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

l.y = b
c.t = b
b.t = c
assert l.y.t.t.txt == "b"