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

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

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

n = A("n")
d = B("d")
i = C("i")
m = B("m")
e = A("e")
h = A("h")
c = A("c")

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

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

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

n = A("n")
d = B("d")
i = C("i")
m = B("m")
e = A("e")
h = A("h")
c = A("c")

n.o = i
d.w = i
i.t = d
m.w = i
e.o = i
h.o = i
c.o = i
assert c.o.t.w.t.w.t.w.txt == "i"