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

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

class C:
    def __init__(self, txt: str):
        self.o: C = None
        self.p: D = None
        self.q: E = None
        self.v: D = None
        self.t: C = None
        self.txt = txt

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

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

n = A("n")
h = B("h")
e = C("e")
a = D("a")
c = E("c")
d = E("d")
m = C("m")
b = E("b")
l = D("l")

n.x = a
h.r = l
h.q = d
h.v = n
h.s = n
h.p = e
e.o = m
e.t = m
e.p = a
e.v = a
e.q = b
a.w = d
a.q = m
c.x = l
c.y = m
d.x = l
d.y = m
m.o = e
m.t = e
m.p = a
m.q = c
m.v = l
b.x = a
b.y = e
l.w = c
l.q = e
assert e.q.x.w.y.q.x.q.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: C = None
        self.p: D = None
        self.q: E = None
        self.v: D = None
        self.t: C = None
        self.txt = txt

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

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

n = A("n")
h = B("h")
e = C("e")
a = D("a")
c = E("c")
d = E("d")
m = C("m")
b = E("b")
l = D("l")

n.x = a
h.r = l
h.q = d
h.v = n
h.s = n
h.p = e
e.o = m
e.t = m
e.p = a
e.v = a
e.q = b
a.w = d
a.q = m
c.x = l
c.y = m
d.x = l
d.y = m
m.o = e
m.t = e
m.p = a
m.q = c
m.v = l
b.x = a
b.y = e
l.w = c
l.q = e
assert e.q.x.w.y.q.x.q.t.v.txt == "l"