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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: C = None
        self.y: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: C = None
        self.p: B = None
        self.y: E = None
        self.x: E = None
        self.txt = txt

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

a = A("a")
e = B("e")
d = C("d")
g = D("g")
k = E("k")
n = A("n")
l = B("l")
j = C("j")
m = C("m")
f = B("f")

a.w = e
e.s = a
e.r = m
e.y = k
d.s = g
d.x = g
g.q = a
g.v = j
g.p = e
g.y = k
g.x = k
k.p = m
k.w = e
n.w = l
l.s = a
l.r = d
l.y = k
j.s = g
j.x = g
m.s = g
m.x = g
f.s = n
f.r = j
f.y = k
assert n.w.r.x.v.x.v.s.x.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: C = None
        self.y: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: C = None
        self.p: B = None
        self.y: E = None
        self.x: E = None
        self.txt = txt

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

a = A("a")
e = B("e")
d = C("d")
g = D("g")
k = E("k")
n = A("n")
l = B("l")
j = C("j")
m = C("m")
f = B("f")

a.w = e
e.s = a
e.r = m
e.y = k
d.s = g
d.x = g
g.q = a
g.v = j
g.p = e
g.y = k
g.x = k
k.p = m
k.w = e
n.w = l
l.s = a
l.r = d
l.y = k
j.s = g
j.x = g
m.s = g
m.x = g
f.s = n
f.r = j
f.y = k
assert n.w.r.x.v.x.v.s.x.w.r.txt == "m"