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

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

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

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

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

k.v = j
k.u = h
k.o = g
k.w = g
b.w = j
b.s = j
g.q = i
g.o = a
g.v = j
a.r = n
h.w = g
h.s = g
n.r = l
l.r = a
e.v = j
e.w = j
e.u = h
e.o = g
j.q = b
j.o = l
j.v = g
i.w = g
i.s = g
assert k.u.w.q.s.q.s.v.o.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: B = None
        self.o: C = None
        self.w: C = None
        self.txt = txt

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

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

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

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

k.v = j
k.u = h
k.o = g
k.w = g
b.w = j
b.s = j
g.q = i
g.o = a
g.v = j
a.r = n
h.w = g
h.s = g
n.r = l
l.r = a
e.v = j
e.w = j
e.u = h
e.o = g
j.q = b
j.o = l
j.v = g
i.w = g
i.s = g
assert k.u.w.q.s.q.s.v.o.r.r.txt == "n"