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

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: D = None
        self.v: A = None
        self.q: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: A = None
        self.x: D = None
        self.u: D = None
        self.p: E = None
        self.txt = txt

h = A("h")
d = B("d")
f = C("f")
c = D("c")
j = E("j")
b = E("b")
a = E("a")
m = D("m")
g = B("g")
n = C("n")

h.w = b
d.v = m
d.w = m
d.q = c
d.x = g
d.p = h
f.v = d
c.w = a
c.x = m
c.q = m
c.v = h
j.s = m
j.x = m
j.q = h
j.u = c
j.p = b
b.s = c
b.q = h
b.x = m
b.u = m
b.p = j
a.s = m
a.u = m
a.q = h
a.x = c
a.p = b
m.w = b
m.x = c
m.q = c
m.v = h
g.v = c
g.w = c
g.q = m
g.x = d
g.p = h
n.v = g
assert m.x.x.w.s.x.w.u.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: D = None
        self.v: A = None
        self.q: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: A = None
        self.x: D = None
        self.u: D = None
        self.p: E = None
        self.txt = txt

h = A("h")
d = B("d")
f = C("f")
c = D("c")
j = E("j")
b = E("b")
a = E("a")
m = D("m")
g = B("g")
n = C("n")

h.w = b
d.v = m
d.w = m
d.q = c
d.x = g
d.p = h
f.v = d
c.w = a
c.x = m
c.q = m
c.v = h
j.s = m
j.x = m
j.q = h
j.u = c
j.p = b
b.s = c
b.q = h
b.x = m
b.u = m
b.p = j
a.s = m
a.u = m
a.q = h
a.x = c
a.p = b
m.w = b
m.x = c
m.q = c
m.v = h
g.v = c
g.w = c
g.q = m
g.x = d
g.p = h
n.v = g
assert m.x.x.w.s.x.w.u.v.w.txt == "b"