class A:
    def __init__(self, txt: str):
        self.r: I = None
        self.z: G = None
        self.q: D = None
        self.v: G = None
        self.o: G = None
        self.p: J = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: E = None
        self.v: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: J = None
        self.o: I = None
        self.s: J = None
        self.w: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: B = None
        self.u: A = None
        self.s: I = None
        self.q: E = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.w: G = None
        self.s: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: G = None
        self.r: I = None
        self.z: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: E = None
        self.v: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: J = None
        self.o: I = None
        self.s: J = None
        self.w: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: B = None
        self.u: A = None
        self.s: I = None
        self.q: E = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.w: G = None
        self.s: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: G = None
        self.r: I = None
        self.z: G = None
        self.txt = txt

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

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