class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: E = None
        self.t: I = None
        self.w: J = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: J = None
        self.x: A = None
        self.u: D = None
        self.v: I = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: J = None
        self.z: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: A = None
        self.r: C = None
        self.s: C = None
        self.w: I = None
        self.o: J = None
        self.t: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: J = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: H = None
        self.w: C = None
        self.u: B = None
        self.z: D = None
        self.p: F = None
        self.t: F = None
        self.x: J = None
        self.v: J = None
        self.s: B = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: J = None
        self.x: A = None
        self.u: D = None
        self.v: I = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: J = None
        self.z: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: A = None
        self.r: C = None
        self.s: C = None
        self.w: I = None
        self.o: J = None
        self.t: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: J = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: H = None
        self.w: C = None
        self.u: B = None
        self.z: D = None
        self.p: F = None
        self.t: F = None
        self.x: J = None
        self.v: J = None
        self.s: B = None
        self.txt = txt

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

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

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