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

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

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

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

e.w = c
e.u = a
a.u = e
c.u = e
c.q = e
assert c.q.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: B = None
        self.txt = txt

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

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

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

e.w = c
e.u = a
a.u = e
c.u = e
c.q = e
assert c.q.u.u.txt == "e"