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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: H = None
        self.v: H = None
        self.z: H = None
        self.t: G = None
        self.p: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: A = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: G = None
        self.q: G = None
        self.u: B = None
        self.o: E = None
        self.s: G = None
        self.x: G = None
        self.t: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: H = None
        self.v: H = None
        self.z: H = None
        self.t: G = None
        self.p: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: A = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: G = None
        self.q: G = None
        self.u: B = None
        self.o: E = None
        self.s: G = None
        self.x: G = None
        self.t: C = None
        self.txt = txt

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

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