class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.s: B = None
        self.o: B = 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.y: A = None
        self.o: B = None
        self.q: C = None
        self.txt = txt

d = A("d")
n = B("n")
m = C("m")
i = B("i")
a = B("a")
h = B("h")
l = B("l")
e = A("e")
k = B("k")
f = C("f")

d.r = e
d.s = k
d.o = h
n.w = m
m.y = e
m.o = i
m.q = f
i.w = m
a.w = m
h.w = m
l.w = f
e.r = d
e.s = a
e.o = n
k.w = f
f.y = e
f.o = i
f.q = m
assert m.q.q.o.w.y.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.s: B = None
        self.o: B = 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.y: A = None
        self.o: B = None
        self.q: C = None
        self.txt = txt

d = A("d")
n = B("n")
m = C("m")
i = B("i")
a = B("a")
h = B("h")
l = B("l")
e = A("e")
k = B("k")
f = C("f")

d.r = e
d.s = k
d.o = h
n.w = m
m.y = e
m.o = i
m.q = f
i.w = m
a.w = m
h.w = m
l.w = f
e.r = d
e.s = a
e.o = n
k.w = f
f.y = e
f.o = i
f.q = m
assert m.q.q.o.w.y.s.w.txt == "m"