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

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

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

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

e.y = i
e.w = i
e.z = a
i.s = e
i.y = a
a.p = i
assert e.y.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: B = None
        self.z: C = None
        self.txt = txt

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

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

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

e.y = i
e.w = i
e.z = a
i.s = e
i.y = a
a.p = i
assert e.y.s.y.txt == "i"