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

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

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

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

m = A("m")
e = B("e")
k = C("k")
i = D("i")
f = A("f")
d = D("d")
c = A("c")
l = A("l")
h = D("h")
a = B("a")

m.p = f
m.z = h
m.w = k
e.u = k
k.v = i
i.z = h
i.v = e
i.s = l
i.r = a
f.p = m
f.z = i
f.w = k
d.z = h
d.v = e
d.s = c
d.r = a
c.p = l
c.z = h
c.w = k
l.p = c
l.z = h
l.w = k
h.z = i
h.v = e
h.s = m
h.r = a
a.u = k
assert m.z.v.u.v.r.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.z: D = None
        self.w: C = None
        self.txt = txt

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

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

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

m = A("m")
e = B("e")
k = C("k")
i = D("i")
f = A("f")
d = D("d")
c = A("c")
l = A("l")
h = D("h")
a = B("a")

m.p = f
m.z = h
m.w = k
e.u = k
k.v = i
i.z = h
i.v = e
i.s = l
i.r = a
f.p = m
f.z = i
f.w = k
d.z = h
d.v = e
d.s = c
d.r = a
c.p = l
c.z = h
c.w = k
l.p = c
l.z = h
l.w = k
h.z = i
h.v = e
h.s = m
h.r = a
a.u = k
assert m.z.v.u.v.r.u.v.txt == "i"