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

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

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

f = A("f")
k = B("k")
m = C("m")

f.o = k
f.s = k
f.v = m
k.w = f
m.z = f
assert k.w.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: C = None
        self.s: B = None
        self.txt = txt

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

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

f = A("f")
k = B("k")
m = C("m")

f.o = k
f.s = k
f.v = m
k.w = f
m.z = f
assert k.w.o.w.txt == "f"