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

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

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

i = A("i")
m = B("m")
a = C("a")
e = A("e")

i.s = e
i.u = a
i.o = a
m.t = a
m.u = a
a.w = m
e.s = i
e.u = a
e.o = a
assert a.w.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: C = None
        self.o: C = None
        self.txt = txt

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

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

i = A("i")
m = B("m")
a = C("a")
e = A("e")

i.s = e
i.u = a
i.o = a
m.t = a
m.u = a
a.w = m
e.s = i
e.u = a
e.o = a
assert a.w.u.w.txt == "m"