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

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

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

j = A("j")
e = B("e")
g = C("g")
i = A("i")

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

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

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

j = A("j")
e = B("e")
g = C("g")
i = A("i")

j.w = i
e.s = g
g.y = e
i.w = j
assert e.s.y.s.y.txt == "e"