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

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

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

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

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

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

a.o = c
c.p = l
l.p = c
assert a.o.p.p.txt == "c"