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

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

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

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

e.y = j
j.y = e
a.p = e
a.u = j
a.s = j
assert j.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

e.y = j
j.y = e
a.p = e
a.u = j
a.s = j
assert j.y.y.y.txt == "e"