class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: B = None
        self.v: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: E = None
        self.p: C = None
        self.q: D = None
        self.txt = txt

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

h = A("h")
j = B("j")
i = C("i")
n = D("n")
l = E("l")
d = D("d")
m = C("m")

h.y = j
h.o = j
h.v = i
j.p = l
i.p = h
i.t = l
n.u = d
n.q = d
n.s = l
n.p = m
l.s = n
d.u = n
d.q = n
d.s = l
d.p = i
m.p = h
m.t = l
assert j.p.s.s.s.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: B = None
        self.v: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: E = None
        self.p: C = None
        self.q: D = None
        self.txt = txt

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

h = A("h")
j = B("j")
i = C("i")
n = D("n")
l = E("l")
d = D("d")
m = C("m")

h.y = j
h.o = j
h.v = i
j.p = l
i.p = h
i.t = l
n.u = d
n.q = d
n.s = l
n.p = m
l.s = n
d.u = n
d.q = n
d.s = l
d.p = i
m.p = h
m.t = l
assert j.p.s.s.s.p.p.txt == "h"