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

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

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

c = A("c")
m = B("m")
n = C("n")
f = C("f")

c.z = m
c.s = m
c.x = m
m.s = c
n.v = c
n.t = f
f.v = c
f.t = n
assert f.t.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: B = None
        self.x: B = None
        self.txt = txt

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

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

c = A("c")
m = B("m")
n = C("n")
f = C("f")

c.z = m
c.s = m
c.x = m
m.s = c
n.v = c
n.t = f
f.v = c
f.t = n
assert f.t.v.z.txt == "m"