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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: C = None
        self.w: B = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: C = None
        self.w: B = None
        self.txt = txt

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

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

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

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

d.q = e
m.u = e
m.s = a
m.w = b
j.q = n
j.w = m
e.z = c
c.s = m
c.t = m
c.q = e
i.z = c
a.q = j
a.w = b
b.u = i
b.s = j
b.w = m
n.q = j
n.w = m
h.q = n
h.w = b
assert b.w.u.z.q.z.t.txt == "m"