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

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: I = None
        self.o: A = None
        self.v: I = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: H = None
        self.z: H = None
        self.q: A = None
        self.r: D = None
        self.o: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.u: F = None
        self.w: B = None
        self.v: F = None
        self.x: F = None
        self.q: G = None
        self.o: E = None
        self.t: F = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.y: H = None
        self.o: E = None
        self.p: H = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: I = None
        self.o: A = None
        self.v: I = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: H = None
        self.z: H = None
        self.q: A = None
        self.r: D = None
        self.o: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.u: F = None
        self.w: B = None
        self.v: F = None
        self.x: F = None
        self.q: G = None
        self.o: E = None
        self.t: F = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.y: H = None
        self.o: E = None
        self.p: H = None
        self.txt = txt

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

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