class A:
    def __init__(self, txt: str):
        self.p: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.q: G = None
        self.s: H = None
        self.x: E = None
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: C = None
        self.o: H = None
        self.x: B = None
        self.p: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: A = None
        self.y: F = None
        self.o: C = None
        self.p: E = None
        self.u: C = None
        self.s: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: A = None
        self.o: A = None
        self.w: A = None
        self.s: B = None
        self.txt = txt

n = A("n")
h = B("h")
a = C("a")
g = D("g")
i = E("i")
j = F("j")
d = G("d")
e = H("e")
m = H("m")

n.p = m
h.x = m
a.o = d
a.q = d
a.s = e
a.x = i
a.r = g
g.q = i
g.z = a
g.p = a
g.o = m
g.x = h
i.y = a
j.s = i
d.t = a
d.o = a
d.u = a
d.z = n
d.y = j
d.p = i
d.s = g
e.z = n
e.o = n
e.w = n
e.s = h
m.z = n
m.o = n
m.w = n
m.s = h
assert a.q.z.p.w.p.s.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.q: G = None
        self.s: H = None
        self.x: E = None
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: C = None
        self.o: H = None
        self.x: B = None
        self.p: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: A = None
        self.y: F = None
        self.o: C = None
        self.p: E = None
        self.u: C = None
        self.s: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: A = None
        self.o: A = None
        self.w: A = None
        self.s: B = None
        self.txt = txt

n = A("n")
h = B("h")
a = C("a")
g = D("g")
i = E("i")
j = F("j")
d = G("d")
e = H("e")
m = H("m")

n.p = m
h.x = m
a.o = d
a.q = d
a.s = e
a.x = i
a.r = g
g.q = i
g.z = a
g.p = a
g.o = m
g.x = h
i.y = a
j.s = i
d.t = a
d.o = a
d.u = a
d.z = n
d.y = j
d.p = i
d.s = g
e.z = n
e.o = n
e.w = n
e.s = h
m.z = n
m.o = n
m.w = n
m.s = h
assert a.q.z.p.w.p.s.x.s.txt == "h"