class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: H = None
        self.o: C = None
        self.r: H = None
        self.u: E = None
        self.p: I = None
        self.v: D = None
        self.y: C = None
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: G = None
        self.z: D = None
        self.y: I = None
        self.w: I = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.r: F = None
        self.x: C = None
        self.u: G = None
        self.w: C = None
        self.t: D = None
        self.o: C = None
        self.y: I = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: I = None
        self.x: I = None
        self.y: D = None
        self.s: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: E = None
        self.u: E = None
        self.s: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: I = None
        self.z: C = None
        self.q: C = None
        self.o: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: C = None
        self.p: B = None
        self.y: F = None
        self.t: A = None
        self.s: H = None
        self.x: D = None
        self.w: I = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.q: G = None
        self.z: D = None
        self.y: I = None
        self.w: I = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.r: F = None
        self.x: C = None
        self.u: G = None
        self.w: C = None
        self.t: D = None
        self.o: C = None
        self.y: I = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: I = None
        self.x: I = None
        self.y: D = None
        self.s: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: E = None
        self.u: E = None
        self.s: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: I = None
        self.z: C = None
        self.q: C = None
        self.o: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: C = None
        self.p: B = None
        self.y: F = None
        self.t: A = None
        self.s: H = None
        self.x: D = None
        self.w: I = None
        self.txt = txt

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

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