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

class B:
    def __init__(self, txt: str):
        self.r: J = None
        self.p: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: G = None
        self.o: E = None
        self.s: I = None
        self.v: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: C = None
        self.t: F = None
        self.r: C = None
        self.u: H = None
        self.q: B = None
        self.txt = txt

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

n.s = a
n.o = a
n.v = k
n.q = k
n.y = m
n.x = h
n.r = h
n.z = f
n.u = d
g.r = f
g.p = m
j.x = d
h.x = a
d.z = h
d.w = m
d.x = f
k.s = d
k.u = d
k.r = h
k.w = g
m.u = j
m.o = h
m.t = n
m.q = n
m.z = i
a.u = d
a.o = d
a.v = d
a.q = m
a.s = i
i.t = n
f.s = m
f.z = j
f.r = j
f.t = k
f.u = a
f.q = g
assert m.z.t.y.o.x.v.w.q.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: H = None
        self.v: F = None
        self.q: F = None
        self.y: G = None
        self.x: D = None
        self.r: D = None
        self.o: H = None
        self.z: J = None
        self.u: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: J = None
        self.p: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: G = None
        self.o: E = None
        self.s: I = None
        self.v: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: C = None
        self.t: F = None
        self.r: C = None
        self.u: H = None
        self.q: B = None
        self.txt = txt

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

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