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

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.z: 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.u: B = None
        self.txt = txt

h = A("h")
e = B("e")
g = C("g")
i = D("i")
f = E("f")
l = E("l")
n = C("n")
a = B("a")
k = E("k")
m = C("m")

h.z = i
e.q = k
e.s = a
e.r = i
e.p = f
e.t = g
g.s = k
g.z = e
i.z = f
f.u = e
l.u = a
n.s = f
n.z = a
a.q = l
a.s = e
a.r = i
a.p = f
a.t = n
k.u = e
m.s = l
m.z = a
assert h.z.z.u.p.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.z: 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.u: B = None
        self.txt = txt

h = A("h")
e = B("e")
g = C("g")
i = D("i")
f = E("f")
l = E("l")
n = C("n")
a = B("a")
k = E("k")
m = C("m")

h.z = i
e.q = k
e.s = a
e.r = i
e.p = f
e.t = g
g.s = k
g.z = e
i.z = f
f.u = e
l.u = a
n.s = f
n.z = a
a.q = l
a.s = e
a.r = i
a.p = f
a.t = n
k.u = e
m.s = l
m.z = a
assert h.z.z.u.p.u.t.txt == "g"