class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: F = None
        self.p: D = None
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: G = None
        self.x: C = None
        self.u: C = None
        self.p: D = None
        self.z: D = None
        self.v: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: H = None
        self.u: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: H = None
        self.p: A = None
        self.v: F = None
        self.z: F = None
        self.w: E = None
        self.s: F = None
        self.q: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: C = None
        self.v: B = None
        self.s: C = None
        self.q: A = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: A = None
        self.t: F = None
        self.o: F = None
        self.x: C = None
        self.z: E = None
        self.r: F = None
        self.q: E = None
        self.txt = txt

f = A("f")
e = B("e")
m = C("m")
n = D("n")
g = E("g")
l = F("l")
c = G("c")
a = H("a")
h = E("h")

f.q = e
f.w = l
f.y = l
f.p = n
e.r = n
e.p = n
e.z = n
e.v = n
e.y = c
e.x = m
e.u = m
m.o = a
m.u = l
n.p = f
n.z = a
n.q = a
n.s = a
g.x = m
g.u = a
g.p = f
g.v = l
g.z = l
g.s = l
g.w = h
g.q = h
l.p = g
l.w = m
l.s = m
l.v = e
l.q = f
c.v = n
c.x = e
c.y = f
a.y = e
a.s = f
a.t = l
a.o = l
a.r = l
a.x = m
a.z = g
a.q = g
h.x = m
h.u = a
h.p = f
h.v = l
h.z = l
h.s = l
h.w = g
h.q = g
assert g.x.u.q.q.x.o.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: F = None
        self.p: D = None
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: G = None
        self.x: C = None
        self.u: C = None
        self.p: D = None
        self.z: D = None
        self.v: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: H = None
        self.u: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: H = None
        self.p: A = None
        self.v: F = None
        self.z: F = None
        self.w: E = None
        self.s: F = None
        self.q: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: C = None
        self.v: B = None
        self.s: C = None
        self.q: A = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: A = None
        self.t: F = None
        self.o: F = None
        self.x: C = None
        self.z: E = None
        self.r: F = None
        self.q: E = None
        self.txt = txt

f = A("f")
e = B("e")
m = C("m")
n = D("n")
g = E("g")
l = F("l")
c = G("c")
a = H("a")
h = E("h")

f.q = e
f.w = l
f.y = l
f.p = n
e.r = n
e.p = n
e.z = n
e.v = n
e.y = c
e.x = m
e.u = m
m.o = a
m.u = l
n.p = f
n.z = a
n.q = a
n.s = a
g.x = m
g.u = a
g.p = f
g.v = l
g.z = l
g.s = l
g.w = h
g.q = h
l.p = g
l.w = m
l.s = m
l.v = e
l.q = f
c.v = n
c.x = e
c.y = f
a.y = e
a.s = f
a.t = l
a.o = l
a.r = l
a.x = m
a.z = g
a.q = g
h.x = m
h.u = a
h.p = f
h.v = l
h.z = l
h.s = l
h.w = g
h.q = g
assert g.x.u.q.q.x.o.z.w.txt == "h"