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

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

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

m = A("m")
b = B("b")
j = C("j")

m.v = j
m.t = j
m.z = b
b.s = j
j.v = m
assert b.s.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: C = None
        self.z: B = None
        self.txt = txt

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

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

m = A("m")
b = B("b")
j = C("j")

m.v = j
m.t = j
m.z = b
b.s = j
j.v = m
assert b.s.v.z.txt == "b"