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

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

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

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

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

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

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

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

j.y = i
a.o = i
a.w = i
a.x = j
i.s = j
i.p = a
assert i.p.x.y.txt == "i"