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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

l = A("l")
b = B("b")
i = C("i")

l.o = i
b.z = l
i.v = l
assert l.o.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

l = A("l")
b = B("b")
i = C("i")

l.o = i
b.z = l
i.v = l
assert l.o.v.o.txt == "i"