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

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

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

m = A("m")
f = B("f")
g = C("g")
l = C("l")
b = C("b")

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

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

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

m = A("m")
f = B("f")
g = C("g")
l = C("l")
b = C("b")

m.x = f
m.z = g
m.s = l
f.v = m
f.x = m
f.o = m
g.w = f
g.y = l
l.w = f
l.y = b
b.w = f
b.y = g
assert f.x.s.w.txt == "f"