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

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

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

e = A("e")
m = B("m")
n = C("n")

e.u = m
e.y = n
m.s = e
m.w = e
n.q = m
n.w = m
assert m.w.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: C = None
        self.txt = txt

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

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

e = A("e")
m = B("m")
n = C("n")

e.u = m
e.y = n
m.s = e
m.w = e
n.q = m
n.w = m
assert m.w.y.q.txt == "m"