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

class B:
    def __init__(self, txt: str):
        self.q: I = None
        self.v: I = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: J = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: I = None
        self.x: B = None
        self.v: G = None
        self.s: A = None
        self.p: A = None
        self.o: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: C = None
        self.z: A = None
        self.q: F = None
        self.o: H = None
        self.r: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: A = None
        self.t: E = None
        self.x: C = None
        self.s: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.w: H = None
        self.q: F = None
        self.x: C = None
        self.r: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.q: I = None
        self.v: I = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: J = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: I = None
        self.x: B = None
        self.v: G = None
        self.s: A = None
        self.p: A = None
        self.o: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: C = None
        self.z: A = None
        self.q: F = None
        self.o: H = None
        self.r: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: A = None
        self.t: E = None
        self.x: C = None
        self.s: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.w: H = None
        self.q: F = None
        self.x: C = None
        self.r: G = None
        self.txt = txt

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

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