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

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

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

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

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

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

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

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

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

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

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

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

l.p = h
l.w = d
l.y = f
i.o = h
i.u = e
i.p = e
i.z = a
e.p = n
e.s = k
e.r = d
e.w = l
d.s = j
d.r = j
d.v = h
a.o = k
a.u = n
h.p = n
h.s = i
h.r = d
h.w = l
j.p = e
j.w = d
j.y = f
n.o = k
n.u = a
k.o = e
k.u = e
k.z = n
k.p = h
f.p = e
f.w = d
f.y = l
assert n.u.u.o.z.o.p.r.txt == "d"