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

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

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

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

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

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

e.s = i
e.r = j
e.w = d
e.q = d
b.w = i
b.p = h
d.y = a
d.w = h
d.z = g
h.w = d
j.r = b
j.v = g
g.r = i
g.v = j
c.w = i
c.p = h
a.s = i
a.r = g
a.w = d
a.q = d
m.s = c
m.r = j
m.w = d
m.q = d
i.w = c
i.p = h
assert m.q.y.s.w.p.w.w.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: E = None
        self.w: C = None
        self.q: C = None
        self.txt = txt

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

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

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

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

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

e.s = i
e.r = j
e.w = d
e.q = d
b.w = i
b.p = h
d.y = a
d.w = h
d.z = g
h.w = d
j.r = b
j.v = g
g.r = i
g.v = j
c.w = i
c.p = h
a.s = i
a.r = g
a.w = d
a.q = d
m.s = c
m.r = j
m.w = d
m.q = d
i.w = c
i.p = h
assert m.q.y.s.w.p.w.w.w.y.txt == "a"