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

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

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

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

f.o = i
b.r = i
b.v = i
b.t = f
i.v = b
i.p = b
i.o = f
assert i.o.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

f.o = i
b.r = i
b.v = i
b.t = f
i.v = b
i.p = b
i.o = f
assert i.o.o.v.txt == "b"