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

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

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

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

c.s = n
i.o = n
i.s = n
i.u = c
n.w = i
assert n.w.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

c.s = n
i.o = n
i.s = n
i.u = c
n.w = i
assert n.w.s.w.txt == "i"