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

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

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

n = A("n")
h = B("h")
a = C("a")
k = C("k")
e = A("e")
d = A("d")
b = A("b")
l = B("l")
m = C("m")
j = A("j")

n.u = l
n.w = b
n.o = h
h.o = l
h.q = j
a.o = m
k.o = a
e.u = l
e.w = b
e.o = h
d.u = l
d.o = l
d.w = e
b.u = l
b.o = l
b.w = e
l.o = h
l.q = d
m.o = a
j.u = h
j.o = h
j.w = n
assert l.o.o.o.q.o.q.w.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: A = None
        self.o: B = None
        self.txt = txt

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

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

n = A("n")
h = B("h")
a = C("a")
k = C("k")
e = A("e")
d = A("d")
b = A("b")
l = B("l")
m = C("m")
j = A("j")

n.u = l
n.w = b
n.o = h
h.o = l
h.q = j
a.o = m
k.o = a
e.u = l
e.w = b
e.o = h
d.u = l
d.o = l
d.w = e
b.u = l
b.o = l
b.w = e
l.o = h
l.q = d
m.o = a
j.u = h
j.o = h
j.w = n
assert l.o.o.o.q.o.q.w.w.o.txt == "l"