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

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

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

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

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

j.v = n
b.p = l
n.s = l
n.o = l
n.q = l
a.o = j
a.u = d
a.q = h
l.s = n
l.o = n
l.q = n
h.o = j
h.u = d
h.q = a
m.o = j
m.u = b
m.q = a
d.p = n
assert n.q.o.q.s.q.o.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

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

j.v = n
b.p = l
n.s = l
n.o = l
n.q = l
a.o = j
a.u = d
a.q = h
l.s = n
l.o = n
l.q = n
h.o = j
h.u = d
h.q = a
m.o = j
m.u = b
m.q = a
d.p = n
assert n.q.o.q.s.q.o.s.q.txt == "n"