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

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

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

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

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

j = A("j")
h = B("h")
f = C("f")
m = D("m")
i = E("i")
d = E("d")
e = C("e")
c = C("c")
n = D("n")

j.p = h
h.v = j
h.s = j
h.z = e
h.t = n
f.w = d
f.v = e
f.y = e
m.v = j
i.p = h
i.w = h
i.r = e
d.p = h
d.w = h
d.r = f
e.w = i
e.v = f
e.y = f
c.w = i
c.v = e
c.y = e
n.v = j
assert h.s.p.t.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

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

j = A("j")
h = B("h")
f = C("f")
m = D("m")
i = E("i")
d = E("d")
e = C("e")
c = C("c")
n = D("n")

j.p = h
h.v = j
h.s = j
h.z = e
h.t = n
f.w = d
f.v = e
f.y = e
m.v = j
i.p = h
i.w = h
i.r = e
d.p = h
d.w = h
d.r = f
e.w = i
e.v = f
e.y = f
c.w = i
c.v = e
c.y = e
n.v = j
assert h.s.p.t.v.p.txt == "h"