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

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

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

a = A("a")
l = B("l")
b = C("b")

a.w = l
l.v = a
l.z = b
b.s = a
assert l.z.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

a = A("a")
l = B("l")
b = C("b")

a.w = l
l.v = a
l.z = b
b.s = a
assert l.z.s.w.txt == "l"