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

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

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

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

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

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

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

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

e.w = i
e.t = n
n.y = m
n.s = m
i.o = e
i.s = n
m.w = i
m.t = n
assert m.t.s.w.txt == "i"