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

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

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

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

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

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

n.q = d
n.z = a
l.z = d
l.p = k
h.x = d
h.t = d
h.s = k
e.o = n
k.x = e
a.z = d
a.p = k
d.x = h
d.t = h
d.s = k
assert n.q.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: B = None
        self.txt = txt

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

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

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

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

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

n.q = d
n.z = a
l.z = d
l.p = k
h.x = d
h.t = d
h.s = k
e.o = n
k.x = e
a.z = d
a.p = k
d.x = h
d.t = h
d.s = k
assert n.q.s.x.txt == "e"