class A:
    def __init__(self, txt: str):
        self.x: G = None
        self.p: G = None
        self.o: G = None
        self.v: D = None
        self.r: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: A = None
        self.v: C = None
        self.s: D = None
        self.o: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: H = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: F = None
        self.u: C = None
        self.y: B = None
        self.p: D = None
        self.w: F = None
        self.z: F = None
        self.o: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: A = None
        self.v: C = None
        self.s: D = None
        self.o: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: H = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: F = None
        self.u: C = None
        self.y: B = None
        self.p: D = None
        self.w: F = None
        self.z: F = None
        self.o: G = None
        self.txt = txt

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

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