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

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: I = None
        self.y: I = None
        self.u: E = None
        self.v: A = None
        self.o: H = None
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: D = None
        self.x: C = None
        self.u: A = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.u: G = None
        self.y: B = None
        self.z: E = None
        self.r: G = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: I = None
        self.y: I = None
        self.u: E = None
        self.v: A = None
        self.o: H = None
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: D = None
        self.x: C = None
        self.u: A = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.u: G = None
        self.y: B = None
        self.z: E = None
        self.r: G = None
        self.txt = txt

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

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

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