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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.w: A = None
        self.v: B = None
        self.x: E = None
        self.y: A = None
        self.txt = txt

h = A("h")
d = B("d")
a = C("a")
l = D("l")
n = E("n")
b = E("b")
i = A("i")
e = B("e")
f = A("f")
g = A("g")

h.p = a
h.w = d
h.y = l
h.o = b
d.p = e
d.z = i
a.u = n
a.r = f
l.z = b
n.u = h
n.w = f
n.y = f
n.v = e
n.x = b
b.u = h
b.w = f
b.v = e
b.x = n
b.y = g
i.p = a
i.w = d
i.y = l
i.o = n
e.p = d
e.z = g
f.p = a
f.w = d
f.y = l
f.o = n
g.p = a
g.w = e
g.y = l
g.o = b
assert l.z.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.w: B = None
        self.y: D = None
        self.o: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.w: A = None
        self.v: B = None
        self.x: E = None
        self.y: A = None
        self.txt = txt

h = A("h")
d = B("d")
a = C("a")
l = D("l")
n = E("n")
b = E("b")
i = A("i")
e = B("e")
f = A("f")
g = A("g")

h.p = a
h.w = d
h.y = l
h.o = b
d.p = e
d.z = i
a.u = n
a.r = f
l.z = b
n.u = h
n.w = f
n.y = f
n.v = e
n.x = b
b.u = h
b.w = f
b.v = e
b.x = n
b.y = g
i.p = a
i.w = d
i.y = l
i.o = n
e.p = d
e.z = g
f.p = a
f.w = d
f.y = l
f.o = n
g.p = a
g.w = e
g.y = l
g.o = b
assert l.z.v.p.txt == "d"