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

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

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

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

c.x = i
c.y = b
i.v = c
i.q = c
b.p = i
assert i.v.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.y: C = None
        self.txt = txt

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

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

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

c.x = i
c.y = b
i.v = c
i.q = c
b.p = i
assert i.v.y.p.txt == "i"