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

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

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

k = A("k")
e = B("e")
c = C("c")

k.o = c
k.v = c
e.y = c
e.w = k
c.z = e
assert k.v.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.v: C = None
        self.txt = txt

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

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

k = A("k")
e = B("e")
c = C("c")

k.o = c
k.v = c
e.y = c
e.w = k
c.z = e
assert k.v.z.w.txt == "k"