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

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

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

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

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

g = A("g")
k = B("k")
m = C("m")
l = D("l")
c = E("c")
h = E("h")
a = E("a")
f = D("f")
n = C("n")
i = A("i")

g.p = f
g.z = m
k.y = c
m.w = f
m.v = i
l.p = n
l.t = g
l.w = g
c.s = g
c.p = a
c.v = l
h.s = g
h.p = c
h.v = f
a.s = g
a.p = h
a.v = l
f.p = m
f.t = g
f.w = g
n.w = f
n.v = g
i.p = f
i.z = m
assert a.s.p.w.p.w.z.w.p.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: C = None
        self.txt = txt

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

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

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

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

g = A("g")
k = B("k")
m = C("m")
l = D("l")
c = E("c")
h = E("h")
a = E("a")
f = D("f")
n = C("n")
i = A("i")

g.p = f
g.z = m
k.y = c
m.w = f
m.v = i
l.p = n
l.t = g
l.w = g
c.s = g
c.p = a
c.v = l
h.s = g
h.p = c
h.v = f
a.s = g
a.p = h
a.v = l
f.p = m
f.t = g
f.w = g
n.w = f
n.v = g
i.p = f
i.z = m
assert a.s.p.w.p.w.z.w.p.v.z.txt == "m"