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

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

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.p: E = None
        self.w: F = None
        self.s: H = None
        self.t: G = None
        self.v: A = None
        self.q: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: G = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: E = None
        self.t: E = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.p: E = None
        self.w: F = None
        self.s: H = None
        self.t: G = None
        self.v: A = None
        self.q: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: G = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: E = None
        self.t: E = None
        self.txt = txt

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

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