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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: E = None
        self.s: A = None
        self.z: D = None
        self.txt = txt

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

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

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

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

i.r = d
i.w = d
i.t = g
i.y = e
i.s = a
e.t = m
e.r = n
e.s = i
e.z = g
a.p = j
a.z = e
a.w = i
g.r = j
g.p = j
n.w = e
n.p = g
j.p = a
j.z = e
j.w = d
d.r = i
d.w = i
d.t = g
d.y = e
d.s = a
m.t = e
m.r = n
m.s = d
m.z = g
assert n.p.r.w.s.z.r.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: A = None
        self.t: D = None
        self.y: B = None
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: E = None
        self.s: A = None
        self.z: D = None
        self.txt = txt

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

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

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

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

i.r = d
i.w = d
i.t = g
i.y = e
i.s = a
e.t = m
e.r = n
e.s = i
e.z = g
a.p = j
a.z = e
a.w = i
g.r = j
g.p = j
n.w = e
n.p = g
j.p = a
j.z = e
j.w = d
d.r = i
d.w = i
d.t = g
d.y = e
d.s = a
m.t = e
m.r = n
m.s = d
m.z = g
assert n.p.r.w.s.z.r.w.t.txt == "m"