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

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

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

n = A("n")
b = B("b")
k = C("k")

n.x = b
n.o = k
b.z = k
b.t = k
k.v = b
k.w = n
assert b.z.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: C = None
        self.txt = txt

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

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

n = A("n")
b = B("b")
k = C("k")

n.x = b
n.o = k
b.z = k
b.t = k
k.v = b
k.w = n
assert b.z.w.o.txt == "k"