class A:
    def __init__(self, txt: str):
        self.q: H = None
        self.t: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: B = None
        self.t: I = None
        self.r: D = None
        self.q: B = None
        self.y: I = None
        self.s: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: H = None
        self.y: G = None
        self.t: G = None
        self.v: E = None
        self.q: B = None
        self.s: C = None
        self.r: E = None
        self.x: G = None
        self.w: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: E = None
        self.w: F = None
        self.z: F = None
        self.x: G = None
        self.v: G = None
        self.s: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.z: G = None
        self.txt = txt

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

e.q = d
e.t = j
j.o = e
j.p = g
j.z = a
k.p = n
k.r = n
k.s = n
k.o = j
k.q = j
k.t = c
k.y = c
n.p = d
n.y = g
n.t = g
n.x = g
n.v = h
n.r = h
n.q = j
n.s = k
n.w = k
h.s = g
h.y = a
h.t = j
h.w = c
h.q = n
a.w = k
g.z = a
g.v = h
g.x = e
g.y = n
d.r = j
d.s = j
d.t = h
d.w = a
d.z = a
d.x = g
d.v = g
c.z = g
assert g.x.t.z.w.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: H = None
        self.t: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: B = None
        self.t: I = None
        self.r: D = None
        self.q: B = None
        self.y: I = None
        self.s: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: H = None
        self.y: G = None
        self.t: G = None
        self.v: E = None
        self.q: B = None
        self.s: C = None
        self.r: E = None
        self.x: G = None
        self.w: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: E = None
        self.w: F = None
        self.z: F = None
        self.x: G = None
        self.v: G = None
        self.s: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.z: G = None
        self.txt = txt

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

e.q = d
e.t = j
j.o = e
j.p = g
j.z = a
k.p = n
k.r = n
k.s = n
k.o = j
k.q = j
k.t = c
k.y = c
n.p = d
n.y = g
n.t = g
n.x = g
n.v = h
n.r = h
n.q = j
n.s = k
n.w = k
h.s = g
h.y = a
h.t = j
h.w = c
h.q = n
a.w = k
g.z = a
g.v = h
g.x = e
g.y = n
d.r = j
d.s = j
d.t = h
d.w = a
d.z = a
d.x = g
d.v = g
c.z = g
assert g.x.t.z.w.y.z.txt == "g"