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

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

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: J = None
        self.o: D = None
        self.s: F = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: H = None
        self.s: J = None
        self.y: E = None
        self.r: H = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: J = None
        self.o: D = None
        self.s: F = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: H = None
        self.s: J = None
        self.y: E = None
        self.r: H = None
        self.txt = txt

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

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

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