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

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

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

j = A("j")
a = B("a")
i = C("i")

j.y = i
a.s = i
a.u = j
i.s = a
i.w = j
assert j.y.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

j = A("j")
a = B("a")
i = C("i")

j.y = i
a.s = i
a.u = j
i.s = a
i.w = j
assert j.y.w.y.txt == "i"