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

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

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

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

c.z = i
i.s = l
i.w = c
l.s = c
l.y = c
l.u = i
assert l.y.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

c.z = i
i.s = l
i.w = c
l.s = c
l.y = c
l.u = i
assert l.y.z.w.txt == "c"