class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.u: F = None
        self.y: B = None
        self.x: B = None
        self.z: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: G = None
        self.s: D = None
        self.t: B = None
        self.x: G = None
        self.u: H = None
        self.o: F = None
        self.p: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: I = None
        self.z: A = None
        self.w: D = None
        self.r: I = None
        self.t: I = None
        self.y: G = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: C = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: G = None
        self.s: D = None
        self.t: B = None
        self.x: G = None
        self.u: H = None
        self.o: F = None
        self.p: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: I = None
        self.z: A = None
        self.w: D = None
        self.r: I = None
        self.t: I = None
        self.y: G = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: C = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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