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

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

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

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

h = A("h")
a = B("a")
m = C("m")
k = D("k")
c = C("c")
b = C("b")
j = A("j")
l = C("l")
i = A("i")
e = A("e")

h.q = a
a.q = i
a.s = k
m.t = i
m.q = k
m.s = c
m.o = b
k.y = a
c.t = h
c.q = k
c.s = l
c.o = l
b.t = j
b.q = k
b.s = l
b.o = c
j.q = a
l.t = i
l.q = k
l.s = m
l.o = m
i.q = a
e.q = a
assert b.o.o.t.q.s.y.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

h = A("h")
a = B("a")
m = C("m")
k = D("k")
c = C("c")
b = C("b")
j = A("j")
l = C("l")
i = A("i")
e = A("e")

h.q = a
a.q = i
a.s = k
m.t = i
m.q = k
m.s = c
m.o = b
k.y = a
c.t = h
c.q = k
c.s = l
c.o = l
b.t = j
b.q = k
b.s = l
b.o = c
j.q = a
l.t = i
l.q = k
l.s = m
l.o = m
i.q = a
e.q = a
assert b.o.o.t.q.s.y.q.q.txt == "a"