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

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

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

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

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

k = A("k")
n = B("n")
d = C("d")
a = D("a")
i = E("i")
c = B("c")
h = C("h")

k.z = a
k.q = a
n.y = k
d.t = k
d.s = a
d.z = h
d.x = i
a.w = k
i.u = k
i.t = c
c.y = k
h.t = k
h.s = a
h.z = d
h.x = i
assert n.y.q.w.z.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: D = None
        self.txt = txt

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

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

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

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

k = A("k")
n = B("n")
d = C("d")
a = D("a")
i = E("i")
c = B("c")
h = C("h")

k.z = a
k.q = a
n.y = k
d.t = k
d.s = a
d.z = h
d.x = i
a.w = k
i.u = k
i.t = c
c.y = k
h.t = k
h.s = a
h.z = d
h.x = i
assert n.y.q.w.z.w.z.txt == "a"