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

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

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

f = A("f")
i = B("i")
l = C("l")

f.s = l
f.w = l
i.x = l
l.z = f
assert f.w.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.w: C = None
        self.txt = txt

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

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

f = A("f")
i = B("i")
l = C("l")

f.s = l
f.w = l
i.x = l
l.z = f
assert f.w.z.w.txt == "l"