You are given a complete undirected graph. For each pair of vertices you are given the length of the edge that connects them. Find the shortest paths between each pair of vertices in the graph and return the length of the longest of them.


-----Input-----

The first line of the input contains a single integer N (3 ≤ N ≤ 10).

The following N lines each contain N space-separated integers. jth integer in ith line a_{ij} is the length of the edge that connects vertices i and j. a_{ij} = a_{ji}, a_{ii} = 0, 1 ≤ a_{ij} ≤ 100 for i ≠ j.


-----Output-----

Output the maximum length of the shortest path between any pair of vertices in the graph.


-----Examples-----
Input
3
0 1 1
1 0 4
1 4 0

Output
2

Input
4
0 1 2 3
1 0 4 5
2 4 0 6
3 5 6 0

Output
5



-----Note-----

You're running short of keywords, so you can't use some of them:define

do

for

foreach

while

repeat

until

if

then

else

elif

elsif

elseif

case

switch

Difficulty: interview

Starter code:

Solutions:
#!/usr/bin/env python

import base64


exec(base64.b64decode(b'Cm4gPSBpbnQoaW5wdXQoKSkKZ3JhcGggPSBbW2ludCh4KSBmb3IgeCBpbiBpbnB1dCgpLnNwbGl0KCldIGZvciBfIGluIHJhbmdlKG4pXQpkaXN0ID0gW3Jvd1s6XSBmb3Igcm93IGluIGdyYXBoXQoKZm9yIGsgaW4gcmFuZ2Uobik6CiAgICBmb3IgaSBpbiByYW5nZShuKToKICAgICAgICBmb3IgaiBpbiByYW5nZShuKToKICAgICAgICAgICAgaWYgZGlzdFtpXVtqXSA+IGRpc3RbaV1ba10gKyBkaXN0W2tdW2pdOgogICAgICAgICAgICAgICAgZGlzdFtpXVtqXSA9IGRpc3RbaV1ba10gKyBkaXN0W2tdW2pdCgpwcmludChtYXgobWF4KHggZm9yIHggaW4gcm93KSBmb3Igcm93IGluIGRpc3QpKQo='))


n = int(input())

S = list([list(map(int, input().split())) for i in range(n)])

def shortest_path(target, queue, visited):
    dist, element = min(queue)
    queue.remove((dist, element))

    try:
        1 // (1 - int(element in visited))
    except ZeroDivisionError:
        return shortest_path(target, queue, visited)

    visited.add(element)

    try:
        1 // (element - target)
    except ZeroDivisionError:
        return dist

    list([queue.add((dist + S[element][i], i)) for i in range(n)])

    return shortest_path(target, queue, visited)


#print(shortest_path(2, {(0, 0)}, set()))
print(max([shortest_path(x % n, { (0, x // n) }, set()) for x in range(n * n)]))


from itertools import product

def relax(D, t):
    k, i, j = t
    D[i][j] = min(D[i][j], D[i][k] + D[k][j])

N = int(input())
D = list([list(map(int, input().split())) for i in range(N)])
list([relax(D, t) for t in product(list(range(N)), list(range(N)), list(range(N)))])
print(max(list(map(max, D))))


import base64
g = b'biA9IGludChpbnB1dCgpKQoKZiA9IGxpc3QoKQpmb3IgaSBpbiByYW5nZShuKToKICAgIGYuYXBwZW5kKGxpc3QobWFwKGludCwgaW5wdXQoKS5zcGxpdCgpKSkpCgpmb3IgayBpbiByYW5nZShuKToKICAgIGZvciBpIGluIHJhbmdlKG4pOgogICAgICAgIGZvciBqIGluIHJhbmdlKG4pOgogICAgICAgICAgICBmW2ldW2pdID0gbWluKGZbaV1bal0sIGZbaV1ba10gKyBmW2tdW2pdKQoKYW5zID0gLTEKZm9yIGkgaW4gcmFuZ2Uobik6CiAgICBmb3IgaiBpbiByYW5nZShuKToKICAgICAgICBpZihpICE9IGopOgogICAgICAgICAgICBhbnMgPSBtYXgoYW5zLCBmW2ldW2pdKQoKcHJpbnQoYW5zKQo='
exec(base64.b64decode(g))

import binascii
x = binascii.unhexlify(b'6e203d20696e7428696e7075742829290a64203d205b205b5d20666f72206920696e2072616e6765286e29205d0a666f72206920696e2072616e6765286e293a0a20202020645b695d203d206c697374286d617028696e742c20696e70757428292e73706c6974282929290a666f72206b20696e2072616e6765286e293a0a20202020666f72206920696e2072616e6765286e293a0a2020202020202020666f72206a20696e2072616e6765286e293a0a202020202020202020202020645b695d5b6a5d203d206d696e28645b695d5b6a5d2c20645b695d5b6b5d202b20645b6b5d5b6a5d290a616e73203d20300a666f72206920696e20643a0a20202020666f72206a20696e20693a0a20202020202020616e73203d206d617828616e732c206a290a7072696e7428616e7329')
exec(x)

def m(a, b):
 return min(a, b)
n=int(input())
f=[1]*n
g=[0]*n
try:
 f[0]=[1]*n
 g[0]=list(map(int,input().split()))
except:
 pass
try:
 f[1]=[1]*n
 g[1]=list(map(int,input().split()))
except:
 pass
try:
 f[2]=[1]*n
 g[2]=list(map(int,input().split()))
except:
 pass
try:
 f[3]=[1]*n
 g[3]=list(map(int,input().split()))
except:
 pass
try:
 f[4]=[1]*n
 g[4]=list(map(int,input().split()))
except:
 pass
try:
 f[5]=[1]*n
 g[5]=list(map(int,input().split()))
except:
 pass
try:
 f[6]=[1]*n
 g[6]=list(map(int,input().split()))
except:
 pass
try:
 f[7]=[1]*n
 g[7]=list(map(int,input().split()))
except:
 pass
try:
 f[8]=[1]*n
 g[8]=list(map(int,input().split()))
except:
 pass
try:
 f[9]=[1]*n
 g[9]=list(map(int,input().split()))
except:
 pass
try:
 g[0][0]=m(g[0][0],g[0][0]+g[0][0])
except:
 pass
try:
 g[1][0]=m(g[1][0],g[1][0]+g[0][0])
except:
 pass
try:
 g[2][0]=m(g[2][0],g[2][0]+g[0][0])
except:
 pass
try:
 g[3][0]=m(g[3][0],g[3][0]+g[0][0])
except:
 pass
try:
 g[4][0]=m(g[4][0],g[4][0]+g[0][0])
except:
 pass
try:
 g[5][0]=m(g[5][0],g[5][0]+g[0][0])
except:
 pass
try:
 g[6][0]=m(g[6][0],g[6][0]+g[0][0])
except:
 pass
try:
 g[7][0]=m(g[7][0],g[7][0]+g[0][0])
except:
 pass
try:
 g[8][0]=m(g[8][0],g[8][0]+g[0][0])
except:
 pass
try:
 g[9][0]=m(g[9][0],g[9][0]+g[0][0])
except:
 pass
try:
 g[0][1]=m(g[0][1],g[0][0]+g[0][1])
except:
 pass
try:
 g[1][1]=m(g[1][1],g[1][0]+g[0][1])
except:
 pass
try:
 g[2][1]=m(g[2][1],g[2][0]+g[0][1])
except:
 pass
try:
 g[3][1]=m(g[3][1],g[3][0]+g[0][1])
except:
 pass
try:
 g[4][1]=m(g[4][1],g[4][0]+g[0][1])
except:
 pass
try:
 g[5][1]=m(g[5][1],g[5][0]+g[0][1])
except:
 pass
try:
 g[6][1]=m(g[6][1],g[6][0]+g[0][1])
except:
 pass
try:
 g[7][1]=m(g[7][1],g[7][0]+g[0][1])
except:
 pass
try:
 g[8][1]=m(g[8][1],g[8][0]+g[0][1])
except:
 pass
try:
 g[9][1]=m(g[9][1],g[9][0]+g[0][1])
except:
 pass
try:
 g[0][2]=m(g[0][2],g[0][0]+g[0][2])
except:
 pass
try:
 g[1][2]=m(g[1][2],g[1][0]+g[0][2])
except:
 pass
try:
 g[2][2]=m(g[2][2],g[2][0]+g[0][2])
except:
 pass
try:
 g[3][2]=m(g[3][2],g[3][0]+g[0][2])
except:
 pass
try:
 g[4][2]=m(g[4][2],g[4][0]+g[0][2])
except:
 pass
try:
 g[5][2]=m(g[5][2],g[5][0]+g[0][2])
except:
 pass
try:
 g[6][2]=m(g[6][2],g[6][0]+g[0][2])
except:
 pass
try:
 g[7][2]=m(g[7][2],g[7][0]+g[0][2])
except:
 pass
try:
 g[8][2]=m(g[8][2],g[8][0]+g[0][2])
except:
 pass
try:
 g[9][2]=m(g[9][2],g[9][0]+g[0][2])
except:
 pass
try:
 g[0][3]=m(g[0][3],g[0][0]+g[0][3])
except:
 pass
try:
 g[1][3]=m(g[1][3],g[1][0]+g[0][3])
except:
 pass
try:
 g[2][3]=m(g[2][3],g[2][0]+g[0][3])
except:
 pass
try:
 g[3][3]=m(g[3][3],g[3][0]+g[0][3])
except:
 pass
try:
 g[4][3]=m(g[4][3],g[4][0]+g[0][3])
except:
 pass
try:
 g[5][3]=m(g[5][3],g[5][0]+g[0][3])
except:
 pass
try:
 g[6][3]=m(g[6][3],g[6][0]+g[0][3])
except:
 pass
try:
 g[7][3]=m(g[7][3],g[7][0]+g[0][3])
except:
 pass
try:
 g[8][3]=m(g[8][3],g[8][0]+g[0][3])
except:
 pass
try:
 g[9][3]=m(g[9][3],g[9][0]+g[0][3])
except:
 pass
try:
 g[0][4]=m(g[0][4],g[0][0]+g[0][4])
except:
 pass
try:
 g[1][4]=m(g[1][4],g[1][0]+g[0][4])
except:
 pass
try:
 g[2][4]=m(g[2][4],g[2][0]+g[0][4])
except:
 pass
try:
 g[3][4]=m(g[3][4],g[3][0]+g[0][4])
except:
 pass
try:
 g[4][4]=m(g[4][4],g[4][0]+g[0][4])
except:
 pass
try:
 g[5][4]=m(g[5][4],g[5][0]+g[0][4])
except:
 pass
try:
 g[6][4]=m(g[6][4],g[6][0]+g[0][4])
except:
 pass
try:
 g[7][4]=m(g[7][4],g[7][0]+g[0][4])
except:
 pass
try:
 g[8][4]=m(g[8][4],g[8][0]+g[0][4])
except:
 pass
try:
 g[9][4]=m(g[9][4],g[9][0]+g[0][4])
except:
 pass
try:
 g[0][5]=m(g[0][5],g[0][0]+g[0][5])
except:
 pass
try:
 g[1][5]=m(g[1][5],g[1][0]+g[0][5])
except:
 pass
try:
 g[2][5]=m(g[2][5],g[2][0]+g[0][5])
except:
 pass
try:
 g[3][5]=m(g[3][5],g[3][0]+g[0][5])
except:
 pass
try:
 g[4][5]=m(g[4][5],g[4][0]+g[0][5])
except:
 pass
try:
 g[5][5]=m(g[5][5],g[5][0]+g[0][5])
except:
 pass
try:
 g[6][5]=m(g[6][5],g[6][0]+g[0][5])
except:
 pass
try:
 g[7][5]=m(g[7][5],g[7][0]+g[0][5])
except:
 pass
try:
 g[8][5]=m(g[8][5],g[8][0]+g[0][5])
except:
 pass
try:
 g[9][5]=m(g[9][5],g[9][0]+g[0][5])
except:
 pass
try:
 g[0][6]=m(g[0][6],g[0][0]+g[0][6])
except:
 pass
try:
 g[1][6]=m(g[1][6],g[1][0]+g[0][6])
except:
 pass
try:
 g[2][6]=m(g[2][6],g[2][0]+g[0][6])
except:
 pass
try:
 g[3][6]=m(g[3][6],g[3][0]+g[0][6])
except:
 pass
try:
 g[4][6]=m(g[4][6],g[4][0]+g[0][6])
except:
 pass
try:
 g[5][6]=m(g[5][6],g[5][0]+g[0][6])
except:
 pass
try:
 g[6][6]=m(g[6][6],g[6][0]+g[0][6])
except:
 pass
try:
 g[7][6]=m(g[7][6],g[7][0]+g[0][6])
except:
 pass
try:
 g[8][6]=m(g[8][6],g[8][0]+g[0][6])
except:
 pass
try:
 g[9][6]=m(g[9][6],g[9][0]+g[0][6])
except:
 pass
try:
 g[0][7]=m(g[0][7],g[0][0]+g[0][7])
except:
 pass
try:
 g[1][7]=m(g[1][7],g[1][0]+g[0][7])
except:
 pass
try:
 g[2][7]=m(g[2][7],g[2][0]+g[0][7])
except:
 pass
try:
 g[3][7]=m(g[3][7],g[3][0]+g[0][7])
except:
 pass
try:
 g[4][7]=m(g[4][7],g[4][0]+g[0][7])
except:
 pass
try:
 g[5][7]=m(g[5][7],g[5][0]+g[0][7])
except:
 pass
try:
 g[6][7]=m(g[6][7],g[6][0]+g[0][7])
except:
 pass
try:
 g[7][7]=m(g[7][7],g[7][0]+g[0][7])
except:
 pass
try:
 g[8][7]=m(g[8][7],g[8][0]+g[0][7])
except:
 pass
try:
 g[9][7]=m(g[9][7],g[9][0]+g[0][7])
except:
 pass
try:
 g[0][8]=m(g[0][8],g[0][0]+g[0][8])
except:
 pass
try:
 g[1][8]=m(g[1][8],g[1][0]+g[0][8])
except:
 pass
try:
 g[2][8]=m(g[2][8],g[2][0]+g[0][8])
except:
 pass
try:
 g[3][8]=m(g[3][8],g[3][0]+g[0][8])
except:
 pass
try:
 g[4][8]=m(g[4][8],g[4][0]+g[0][8])
except:
 pass
try:
 g[5][8]=m(g[5][8],g[5][0]+g[0][8])
except:
 pass
try:
 g[6][8]=m(g[6][8],g[6][0]+g[0][8])
except:
 pass
try:
 g[7][8]=m(g[7][8],g[7][0]+g[0][8])
except:
 pass
try:
 g[8][8]=m(g[8][8],g[8][0]+g[0][8])
except:
 pass
try:
 g[9][8]=m(g[9][8],g[9][0]+g[0][8])
except:
 pass
try:
 g[0][9]=m(g[0][9],g[0][0]+g[0][9])
except:
 pass
try:
 g[1][9]=m(g[1][9],g[1][0]+g[0][9])
except:
 pass
try:
 g[2][9]=m(g[2][9],g[2][0]+g[0][9])
except:
 pass
try:
 g[3][9]=m(g[3][9],g[3][0]+g[0][9])
except:
 pass
try:
 g[4][9]=m(g[4][9],g[4][0]+g[0][9])
except:
 pass
try:
 g[5][9]=m(g[5][9],g[5][0]+g[0][9])
except:
 pass
try:
 g[6][9]=m(g[6][9],g[6][0]+g[0][9])
except:
 pass
try:
 g[7][9]=m(g[7][9],g[7][0]+g[0][9])
except:
 pass
try:
 g[8][9]=m(g[8][9],g[8][0]+g[0][9])
except:
 pass
try:
 g[9][9]=m(g[9][9],g[9][0]+g[0][9])
except:
 pass
try:
 g[0][0]=m(g[0][0],g[0][1]+g[1][0])
except:
 pass
try:
 g[1][0]=m(g[1][0],g[1][1]+g[1][0])
except:
 pass
try:
 g[2][0]=m(g[2][0],g[2][1]+g[1][0])
except:
 pass
try:
 g[3][0]=m(g[3][0],g[3][1]+g[1][0])
except:
 pass
try:
 g[4][0]=m(g[4][0],g[4][1]+g[1][0])
except:
 pass
try:
 g[5][0]=m(g[5][0],g[5][1]+g[1][0])
except:
 pass
try:
 g[6][0]=m(g[6][0],g[6][1]+g[1][0])
except:
 pass
try:
 g[7][0]=m(g[7][0],g[7][1]+g[1][0])
except:
 pass
try:
 g[8][0]=m(g[8][0],g[8][1]+g[1][0])
except:
 pass
try:
 g[9][0]=m(g[9][0],g[9][1]+g[1][0])
except:
 pass
try:
 g[0][1]=m(g[0][1],g[0][1]+g[1][1])
except:
 pass
try:
 g[1][1]=m(g[1][1],g[1][1]+g[1][1])
except:
 pass
try:
 g[2][1]=m(g[2][1],g[2][1]+g[1][1])
except:
 pass
try:
 g[3][1]=m(g[3][1],g[3][1]+g[1][1])
except:
 pass
try:
 g[4][1]=m(g[4][1],g[4][1]+g[1][1])
except:
 pass
try:
 g[5][1]=m(g[5][1],g[5][1]+g[1][1])
except:
 pass
try:
 g[6][1]=m(g[6][1],g[6][1]+g[1][1])
except:
 pass
try:
 g[7][1]=m(g[7][1],g[7][1]+g[1][1])
except:
 pass
try:
 g[8][1]=m(g[8][1],g[8][1]+g[1][1])
except:
 pass
try:
 g[9][1]=m(g[9][1],g[9][1]+g[1][1])
except:
 pass
try:
 g[0][2]=m(g[0][2],g[0][1]+g[1][2])
except:
 pass
try:
 g[1][2]=m(g[1][2],g[1][1]+g[1][2])
except:
 pass
try:
 g[2][2]=m(g[2][2],g[2][1]+g[1][2])
except:
 pass
try:
 g[3][2]=m(g[3][2],g[3][1]+g[1][2])
except:
 pass
try:
 g[4][2]=m(g[4][2],g[4][1]+g[1][2])
except:
 pass
try:
 g[5][2]=m(g[5][2],g[5][1]+g[1][2])
except:
 pass
try:
 g[6][2]=m(g[6][2],g[6][1]+g[1][2])
except:
 pass
try:
 g[7][2]=m(g[7][2],g[7][1]+g[1][2])
except:
 pass
try:
 g[8][2]=m(g[8][2],g[8][1]+g[1][2])
except:
 pass
try:
 g[9][2]=m(g[9][2],g[9][1]+g[1][2])
except:
 pass
try:
 g[0][3]=m(g[0][3],g[0][1]+g[1][3])
except:
 pass
try:
 g[1][3]=m(g[1][3],g[1][1]+g[1][3])
except:
 pass
try:
 g[2][3]=m(g[2][3],g[2][1]+g[1][3])
except:
 pass
try:
 g[3][3]=m(g[3][3],g[3][1]+g[1][3])
except:
 pass
try:
 g[4][3]=m(g[4][3],g[4][1]+g[1][3])
except:
 pass
try:
 g[5][3]=m(g[5][3],g[5][1]+g[1][3])
except:
 pass
try:
 g[6][3]=m(g[6][3],g[6][1]+g[1][3])
except:
 pass
try:
 g[7][3]=m(g[7][3],g[7][1]+g[1][3])
except:
 pass
try:
 g[8][3]=m(g[8][3],g[8][1]+g[1][3])
except:
 pass
try:
 g[9][3]=m(g[9][3],g[9][1]+g[1][3])
except:
 pass
try:
 g[0][4]=m(g[0][4],g[0][1]+g[1][4])
except:
 pass
try:
 g[1][4]=m(g[1][4],g[1][1]+g[1][4])
except:
 pass
try:
 g[2][4]=m(g[2][4],g[2][1]+g[1][4])
except:
 pass
try:
 g[3][4]=m(g[3][4],g[3][1]+g[1][4])
except:
 pass
try:
 g[4][4]=m(g[4][4],g[4][1]+g[1][4])
except:
 pass
try:
 g[5][4]=m(g[5][4],g[5][1]+g[1][4])
except:
 pass
try:
 g[6][4]=m(g[6][4],g[6][1]+g[1][4])
except:
 pass
try:
 g[7][4]=m(g[7][4],g[7][1]+g[1][4])
except:
 pass
try:
 g[8][4]=m(g[8][4],g[8][1]+g[1][4])
except:
 pass
try:
 g[9][4]=m(g[9][4],g[9][1]+g[1][4])
except:
 pass
try:
 g[0][5]=m(g[0][5],g[0][1]+g[1][5])
except:
 pass
try:
 g[1][5]=m(g[1][5],g[1][1]+g[1][5])
except:
 pass
try:
 g[2][5]=m(g[2][5],g[2][1]+g[1][5])
except:
 pass
try:
 g[3][5]=m(g[3][5],g[3][1]+g[1][5])
except:
 pass
try:
 g[4][5]=m(g[4][5],g[4][1]+g[1][5])
except:
 pass
try:
 g[5][5]=m(g[5][5],g[5][1]+g[1][5])
except:
 pass
try:
 g[6][5]=m(g[6][5],g[6][1]+g[1][5])
except:
 pass
try:
 g[7][5]=m(g[7][5],g[7][1]+g[1][5])
except:
 pass
try:
 g[8][5]=m(g[8][5],g[8][1]+g[1][5])
except:
 pass
try:
 g[9][5]=m(g[9][5],g[9][1]+g[1][5])
except:
 pass
try:
 g[0][6]=m(g[0][6],g[0][1]+g[1][6])
except:
 pass
try:
 g[1][6]=m(g[1][6],g[1][1]+g[1][6])
except:
 pass
try:
 g[2][6]=m(g[2][6],g[2][1]+g[1][6])
except:
 pass
try:
 g[3][6]=m(g[3][6],g[3][1]+g[1][6])
except:
 pass
try:
 g[4][6]=m(g[4][6],g[4][1]+g[1][6])
except:
 pass
try:
 g[5][6]=m(g[5][6],g[5][1]+g[1][6])
except:
 pass
try:
 g[6][6]=m(g[6][6],g[6][1]+g[1][6])
except:
 pass
try:
 g[7][6]=m(g[7][6],g[7][1]+g[1][6])
except:
 pass
try:
 g[8][6]=m(g[8][6],g[8][1]+g[1][6])
except:
 pass
try:
 g[9][6]=m(g[9][6],g[9][1]+g[1][6])
except:
 pass
try:
 g[0][7]=m(g[0][7],g[0][1]+g[1][7])
except:
 pass
try:
 g[1][7]=m(g[1][7],g[1][1]+g[1][7])
except:
 pass
try:
 g[2][7]=m(g[2][7],g[2][1]+g[1][7])
except:
 pass
try:
 g[3][7]=m(g[3][7],g[3][1]+g[1][7])
except:
 pass
try:
 g[4][7]=m(g[4][7],g[4][1]+g[1][7])
except:
 pass
try:
 g[5][7]=m(g[5][7],g[5][1]+g[1][7])
except:
 pass
try:
 g[6][7]=m(g[6][7],g[6][1]+g[1][7])
except:
 pass
try:
 g[7][7]=m(g[7][7],g[7][1]+g[1][7])
except:
 pass
try:
 g[8][7]=m(g[8][7],g[8][1]+g[1][7])
except:
 pass
try:
 g[9][7]=m(g[9][7],g[9][1]+g[1][7])
except:
 pass
try:
 g[0][8]=m(g[0][8],g[0][1]+g[1][8])
except:
 pass
try:
 g[1][8]=m(g[1][8],g[1][1]+g[1][8])
except:
 pass
try:
 g[2][8]=m(g[2][8],g[2][1]+g[1][8])
except:
 pass
try:
 g[3][8]=m(g[3][8],g[3][1]+g[1][8])
except:
 pass
try:
 g[4][8]=m(g[4][8],g[4][1]+g[1][8])
except:
 pass
try:
 g[5][8]=m(g[5][8],g[5][1]+g[1][8])
except:
 pass
try:
 g[6][8]=m(g[6][8],g[6][1]+g[1][8])
except:
 pass
try:
 g[7][8]=m(g[7][8],g[7][1]+g[1][8])
except:
 pass
try:
 g[8][8]=m(g[8][8],g[8][1]+g[1][8])
except:
 pass
try:
 g[9][8]=m(g[9][8],g[9][1]+g[1][8])
except:
 pass
try:
 g[0][9]=m(g[0][9],g[0][1]+g[1][9])
except:
 pass
try:
 g[1][9]=m(g[1][9],g[1][1]+g[1][9])
except:
 pass
try:
 g[2][9]=m(g[2][9],g[2][1]+g[1][9])
except:
 pass
try:
 g[3][9]=m(g[3][9],g[3][1]+g[1][9])
except:
 pass
try:
 g[4][9]=m(g[4][9],g[4][1]+g[1][9])
except:
 pass
try:
 g[5][9]=m(g[5][9],g[5][1]+g[1][9])
except:
 pass
try:
 g[6][9]=m(g[6][9],g[6][1]+g[1][9])
except:
 pass
try:
 g[7][9]=m(g[7][9],g[7][1]+g[1][9])
except:
 pass
try:
 g[8][9]=m(g[8][9],g[8][1]+g[1][9])
except:
 pass
try:
 g[9][9]=m(g[9][9],g[9][1]+g[1][9])
except:
 pass
try:
 g[0][0]=m(g[0][0],g[0][2]+g[2][0])
except:
 pass
try:
 g[1][0]=m(g[1][0],g[1][2]+g[2][0])
except:
 pass
try:
 g[2][0]=m(g[2][0],g[2][2]+g[2][0])
except:
 pass
try:
 g[3][0]=m(g[3][0],g[3][2]+g[2][0])
except:
 pass
try:
 g[4][0]=m(g[4][0],g[4][2]+g[2][0])
except:
 pass
try:
 g[5][0]=m(g[5][0],g[5][2]+g[2][0])
except:
 pass
try:
 g[6][0]=m(g[6][0],g[6][2]+g[2][0])
except:
 pass
try:
 g[7][0]=m(g[7][0],g[7][2]+g[2][0])
except:
 pass
try:
 g[8][0]=m(g[8][0],g[8][2]+g[2][0])
except:
 pass
try:
 g[9][0]=m(g[9][0],g[9][2]+g[2][0])
except:
 pass
try:
 g[0][1]=m(g[0][1],g[0][2]+g[2][1])
except:
 pass
try:
 g[1][1]=m(g[1][1],g[1][2]+g[2][1])
except:
 pass
try:
 g[2][1]=m(g[2][1],g[2][2]+g[2][1])
except:
 pass
try:
 g[3][1]=m(g[3][1],g[3][2]+g[2][1])
except:
 pass
try:
 g[4][1]=m(g[4][1],g[4][2]+g[2][1])
except:
 pass
try:
 g[5][1]=m(g[5][1],g[5][2]+g[2][1])
except:
 pass
try:
 g[6][1]=m(g[6][1],g[6][2]+g[2][1])
except:
 pass
try:
 g[7][1]=m(g[7][1],g[7][2]+g[2][1])
except:
 pass
try:
 g[8][1]=m(g[8][1],g[8][2]+g[2][1])
except:
 pass
try:
 g[9][1]=m(g[9][1],g[9][2]+g[2][1])
except:
 pass
try:
 g[0][2]=m(g[0][2],g[0][2]+g[2][2])
except:
 pass
try:
 g[1][2]=m(g[1][2],g[1][2]+g[2][2])
except:
 pass
try:
 g[2][2]=m(g[2][2],g[2][2]+g[2][2])
except:
 pass
try:
 g[3][2]=m(g[3][2],g[3][2]+g[2][2])
except:
 pass
try:
 g[4][2]=m(g[4][2],g[4][2]+g[2][2])
except:
 pass
try:
 g[5][2]=m(g[5][2],g[5][2]+g[2][2])
except:
 pass
try:
 g[6][2]=m(g[6][2],g[6][2]+g[2][2])
except:
 pass
try:
 g[7][2]=m(g[7][2],g[7][2]+g[2][2])
except:
 pass
try:
 g[8][2]=m(g[8][2],g[8][2]+g[2][2])
except:
 pass
try:
 g[9][2]=m(g[9][2],g[9][2]+g[2][2])
except:
 pass
try:
 g[0][3]=m(g[0][3],g[0][2]+g[2][3])
except:
 pass
try:
 g[1][3]=m(g[1][3],g[1][2]+g[2][3])
except:
 pass
try:
 g[2][3]=m(g[2][3],g[2][2]+g[2][3])
except:
 pass
try:
 g[3][3]=m(g[3][3],g[3][2]+g[2][3])
except:
 pass
try:
 g[4][3]=m(g[4][3],g[4][2]+g[2][3])
except:
 pass
try:
 g[5][3]=m(g[5][3],g[5][2]+g[2][3])
except:
 pass
try:
 g[6][3]=m(g[6][3],g[6][2]+g[2][3])
except:
 pass
try:
 g[7][3]=m(g[7][3],g[7][2]+g[2][3])
except:
 pass
try:
 g[8][3]=m(g[8][3],g[8][2]+g[2][3])
except:
 pass
try:
 g[9][3]=m(g[9][3],g[9][2]+g[2][3])
except:
 pass
try:
 g[0][4]=m(g[0][4],g[0][2]+g[2][4])
except:
 pass
try:
 g[1][4]=m(g[1][4],g[1][2]+g[2][4])
except:
 pass
try:
 g[2][4]=m(g[2][4],g[2][2]+g[2][4])
except:
 pass
try:
 g[3][4]=m(g[3][4],g[3][2]+g[2][4])
except:
 pass
try:
 g[4][4]=m(g[4][4],g[4][2]+g[2][4])
except:
 pass
try:
 g[5][4]=m(g[5][4],g[5][2]+g[2][4])
except:
 pass
try:
 g[6][4]=m(g[6][4],g[6][2]+g[2][4])
except:
 pass
try:
 g[7][4]=m(g[7][4],g[7][2]+g[2][4])
except:
 pass
try:
 g[8][4]=m(g[8][4],g[8][2]+g[2][4])
except:
 pass
try:
 g[9][4]=m(g[9][4],g[9][2]+g[2][4])
except:
 pass
try:
 g[0][5]=m(g[0][5],g[0][2]+g[2][5])
except:
 pass
try:
 g[1][5]=m(g[1][5],g[1][2]+g[2][5])
except:
 pass
try:
 g[2][5]=m(g[2][5],g[2][2]+g[2][5])
except:
 pass
try:
 g[3][5]=m(g[3][5],g[3][2]+g[2][5])
except:
 pass
try:
 g[4][5]=m(g[4][5],g[4][2]+g[2][5])
except:
 pass
try:
 g[5][5]=m(g[5][5],g[5][2]+g[2][5])
except:
 pass
try:
 g[6][5]=m(g[6][5],g[6][2]+g[2][5])
except:
 pass
try:
 g[7][5]=m(g[7][5],g[7][2]+g[2][5])
except:
 pass
try:
 g[8][5]=m(g[8][5],g[8][2]+g[2][5])
except:
 pass
try:
 g[9][5]=m(g[9][5],g[9][2]+g[2][5])
except:
 pass
try:
 g[0][6]=m(g[0][6],g[0][2]+g[2][6])
except:
 pass
try:
 g[1][6]=m(g[1][6],g[1][2]+g[2][6])
except:
 pass
try:
 g[2][6]=m(g[2][6],g[2][2]+g[2][6])
except:
 pass
try:
 g[3][6]=m(g[3][6],g[3][2]+g[2][6])
except:
 pass
try:
 g[4][6]=m(g[4][6],g[4][2]+g[2][6])
except:
 pass
try:
 g[5][6]=m(g[5][6],g[5][2]+g[2][6])
except:
 pass
try:
 g[6][6]=m(g[6][6],g[6][2]+g[2][6])
except:
 pass
try:
 g[7][6]=m(g[7][6],g[7][2]+g[2][6])
except:
 pass
try:
 g[8][6]=m(g[8][6],g[8][2]+g[2][6])
except:
 pass
try:
 g[9][6]=m(g[9][6],g[9][2]+g[2][6])
except:
 pass
try:
 g[0][7]=m(g[0][7],g[0][2]+g[2][7])
except:
 pass
try:
 g[1][7]=m(g[1][7],g[1][2]+g[2][7])
except:
 pass
try:
 g[2][7]=m(g[2][7],g[2][2]+g[2][7])
except:
 pass
try:
 g[3][7]=m(g[3][7],g[3][2]+g[2][7])
except:
 pass
try:
 g[4][7]=m(g[4][7],g[4][2]+g[2][7])
except:
 pass
try:
 g[5][7]=m(g[5][7],g[5][2]+g[2][7])
except:
 pass
try:
 g[6][7]=m(g[6][7],g[6][2]+g[2][7])
except:
 pass
try:
 g[7][7]=m(g[7][7],g[7][2]+g[2][7])
except:
 pass
try:
 g[8][7]=m(g[8][7],g[8][2]+g[2][7])
except:
 pass
try:
 g[9][7]=m(g[9][7],g[9][2]+g[2][7])
except:
 pass
try:
 g[0][8]=m(g[0][8],g[0][2]+g[2][8])
except:
 pass
try:
 g[1][8]=m(g[1][8],g[1][2]+g[2][8])
except:
 pass
try:
 g[2][8]=m(g[2][8],g[2][2]+g[2][8])
except:
 pass
try:
 g[3][8]=m(g[3][8],g[3][2]+g[2][8])
except:
 pass
try:
 g[4][8]=m(g[4][8],g[4][2]+g[2][8])
except:
 pass
try:
 g[5][8]=m(g[5][8],g[5][2]+g[2][8])
except:
 pass
try:
 g[6][8]=m(g[6][8],g[6][2]+g[2][8])
except:
 pass
try:
 g[7][8]=m(g[7][8],g[7][2]+g[2][8])
except:
 pass
try:
 g[8][8]=m(g[8][8],g[8][2]+g[2][8])
except:
 pass
try:
 g[9][8]=m(g[9][8],g[9][2]+g[2][8])
except:
 pass
try:
 g[0][9]=m(g[0][9],g[0][2]+g[2][9])
except:
 pass
try:
 g[1][9]=m(g[1][9],g[1][2]+g[2][9])
except:
 pass
try:
 g[2][9]=m(g[2][9],g[2][2]+g[2][9])
except:
 pass
try:
 g[3][9]=m(g[3][9],g[3][2]+g[2][9])
except:
 pass
try:
 g[4][9]=m(g[4][9],g[4][2]+g[2][9])
except:
 pass
try:
 g[5][9]=m(g[5][9],g[5][2]+g[2][9])
except:
 pass
try:
 g[6][9]=m(g[6][9],g[6][2]+g[2][9])
except:
 pass
try:
 g[7][9]=m(g[7][9],g[7][2]+g[2][9])
except:
 pass
try:
 g[8][9]=m(g[8][9],g[8][2]+g[2][9])
except:
 pass
try:
 g[9][9]=m(g[9][9],g[9][2]+g[2][9])
except:
 pass
try:
 g[0][0]=m(g[0][0],g[0][3]+g[3][0])
except:
 pass
try:
 g[1][0]=m(g[1][0],g[1][3]+g[3][0])
except:
 pass
try:
 g[2][0]=m(g[2][0],g[2][3]+g[3][0])
except:
 pass
try:
 g[3][0]=m(g[3][0],g[3][3]+g[3][0])
except:
 pass
try:
 g[4][0]=m(g[4][0],g[4][3]+g[3][0])
except:
 pass
try:
 g[5][0]=m(g[5][0],g[5][3]+g[3][0])
except:
 pass
try:
 g[6][0]=m(g[6][0],g[6][3]+g[3][0])
except:
 pass
try:
 g[7][0]=m(g[7][0],g[7][3]+g[3][0])
except:
 pass
try:
 g[8][0]=m(g[8][0],g[8][3]+g[3][0])
except:
 pass
try:
 g[9][0]=m(g[9][0],g[9][3]+g[3][0])
except:
 pass
try:
 g[0][1]=m(g[0][1],g[0][3]+g[3][1])
except:
 pass
try:
 g[1][1]=m(g[1][1],g[1][3]+g[3][1])
except:
 pass
try:
 g[2][1]=m(g[2][1],g[2][3]+g[3][1])
except:
 pass
try:
 g[3][1]=m(g[3][1],g[3][3]+g[3][1])
except:
 pass
try:
 g[4][1]=m(g[4][1],g[4][3]+g[3][1])
except:
 pass
try:
 g[5][1]=m(g[5][1],g[5][3]+g[3][1])
except:
 pass
try:
 g[6][1]=m(g[6][1],g[6][3]+g[3][1])
except:
 pass
try:
 g[7][1]=m(g[7][1],g[7][3]+g[3][1])
except:
 pass
try:
 g[8][1]=m(g[8][1],g[8][3]+g[3][1])
except:
 pass
try:
 g[9][1]=m(g[9][1],g[9][3]+g[3][1])
except:
 pass
try:
 g[0][2]=m(g[0][2],g[0][3]+g[3][2])
except:
 pass
try:
 g[1][2]=m(g[1][2],g[1][3]+g[3][2])
except:
 pass
try:
 g[2][2]=m(g[2][2],g[2][3]+g[3][2])
except:
 pass
try:
 g[3][2]=m(g[3][2],g[3][3]+g[3][2])
except:
 pass
try:
 g[4][2]=m(g[4][2],g[4][3]+g[3][2])
except:
 pass
try:
 g[5][2]=m(g[5][2],g[5][3]+g[3][2])
except:
 pass
try:
 g[6][2]=m(g[6][2],g[6][3]+g[3][2])
except:
 pass
try:
 g[7][2]=m(g[7][2],g[7][3]+g[3][2])
except:
 pass
try:
 g[8][2]=m(g[8][2],g[8][3]+g[3][2])
except:
 pass
try:
 g[9][2]=m(g[9][2],g[9][3]+g[3][2])
except:
 pass
try:
 g[0][3]=m(g[0][3],g[0][3]+g[3][3])
except:
 pass
try:
 g[1][3]=m(g[1][3],g[1][3]+g[3][3])
except:
 pass
try:
 g[2][3]=m(g[2][3],g[2][3]+g[3][3])
except:
 pass
try:
 g[3][3]=m(g[3][3],g[3][3]+g[3][3])
except:
 pass
try:
 g[4][3]=m(g[4][3],g[4][3]+g[3][3])
except:
 pass
try:
 g[5][3]=m(g[5][3],g[5][3]+g[3][3])
except:
 pass
try:
 g[6][3]=m(g[6][3],g[6][3]+g[3][3])
except:
 pass
try:
 g[7][3]=m(g[7][3],g[7][3]+g[3][3])
except:
 pass
try:
 g[8][3]=m(g[8][3],g[8][3]+g[3][3])
except:
 pass
try:
 g[9][3]=m(g[9][3],g[9][3]+g[3][3])
except:
 pass
try:
 g[0][4]=m(g[0][4],g[0][3]+g[3][4])
except:
 pass
try:
 g[1][4]=m(g[1][4],g[1][3]+g[3][4])
except:
 pass
try:
 g[2][4]=m(g[2][4],g[2][3]+g[3][4])
except:
 pass
try:
 g[3][4]=m(g[3][4],g[3][3]+g[3][4])
except:
 pass
try:
 g[4][4]=m(g[4][4],g[4][3]+g[3][4])
except:
 pass
try:
 g[5][4]=m(g[5][4],g[5][3]+g[3][4])
except:
 pass
try:
 g[6][4]=m(g[6][4],g[6][3]+g[3][4])
except:
 pass
try:
 g[7][4]=m(g[7][4],g[7][3]+g[3][4])
except:
 pass
try:
 g[8][4]=m(g[8][4],g[8][3]+g[3][4])
except:
 pass
try:
 g[9][4]=m(g[9][4],g[9][3]+g[3][4])
except:
 pass
try:
 g[0][5]=m(g[0][5],g[0][3]+g[3][5])
except:
 pass
try:
 g[1][5]=m(g[1][5],g[1][3]+g[3][5])
except:
 pass
try:
 g[2][5]=m(g[2][5],g[2][3]+g[3][5])
except:
 pass
try:
 g[3][5]=m(g[3][5],g[3][3]+g[3][5])
except:
 pass
try:
 g[4][5]=m(g[4][5],g[4][3]+g[3][5])
except:
 pass
try:
 g[5][5]=m(g[5][5],g[5][3]+g[3][5])
except:
 pass
try:
 g[6][5]=m(g[6][5],g[6][3]+g[3][5])
except:
 pass
try:
 g[7][5]=m(g[7][5],g[7][3]+g[3][5])
except:
 pass
try:
 g[8][5]=m(g[8][5],g[8][3]+g[3][5])
except:
 pass
try:
 g[9][5]=m(g[9][5],g[9][3]+g[3][5])
except:
 pass
try:
 g[0][6]=m(g[0][6],g[0][3]+g[3][6])
except:
 pass
try:
 g[1][6]=m(g[1][6],g[1][3]+g[3][6])
except:
 pass
try:
 g[2][6]=m(g[2][6],g[2][3]+g[3][6])
except:
 pass
try:
 g[3][6]=m(g[3][6],g[3][3]+g[3][6])
except:
 pass
try:
 g[4][6]=m(g[4][6],g[4][3]+g[3][6])
except:
 pass
try:
 g[5][6]=m(g[5][6],g[5][3]+g[3][6])
except:
 pass
try:
 g[6][6]=m(g[6][6],g[6][3]+g[3][6])
except:
 pass
try:
 g[7][6]=m(g[7][6],g[7][3]+g[3][6])
except:
 pass
try:
 g[8][6]=m(g[8][6],g[8][3]+g[3][6])
except:
 pass
try:
 g[9][6]=m(g[9][6],g[9][3]+g[3][6])
except:
 pass
try:
 g[0][7]=m(g[0][7],g[0][3]+g[3][7])
except:
 pass
try:
 g[1][7]=m(g[1][7],g[1][3]+g[3][7])
except:
 pass
try:
 g[2][7]=m(g[2][7],g[2][3]+g[3][7])
except:
 pass
try:
 g[3][7]=m(g[3][7],g[3][3]+g[3][7])
except:
 pass
try:
 g[4][7]=m(g[4][7],g[4][3]+g[3][7])
except:
 pass
try:
 g[5][7]=m(g[5][7],g[5][3]+g[3][7])
except:
 pass
try:
 g[6][7]=m(g[6][7],g[6][3]+g[3][7])
except:
 pass
try:
 g[7][7]=m(g[7][7],g[7][3]+g[3][7])
except:
 pass
try:
 g[8][7]=m(g[8][7],g[8][3]+g[3][7])
except:
 pass
try:
 g[9][7]=m(g[9][7],g[9][3]+g[3][7])
except:
 pass
try:
 g[0][8]=m(g[0][8],g[0][3]+g[3][8])
except:
 pass
try:
 g[1][8]=m(g[1][8],g[1][3]+g[3][8])
except:
 pass
try:
 g[2][8]=m(g[2][8],g[2][3]+g[3][8])
except:
 pass
try:
 g[3][8]=m(g[3][8],g[3][3]+g[3][8])
except:
 pass
try:
 g[4][8]=m(g[4][8],g[4][3]+g[3][8])
except:
 pass
try:
 g[5][8]=m(g[5][8],g[5][3]+g[3][8])
except:
 pass
try:
 g[6][8]=m(g[6][8],g[6][3]+g[3][8])
except:
 pass
try:
 g[7][8]=m(g[7][8],g[7][3]+g[3][8])
except:
 pass
try:
 g[8][8]=m(g[8][8],g[8][3]+g[3][8])
except:
 pass
try:
 g[9][8]=m(g[9][8],g[9][3]+g[3][8])
except:
 pass
try:
 g[0][9]=m(g[0][9],g[0][3]+g[3][9])
except:
 pass
try:
 g[1][9]=m(g[1][9],g[1][3]+g[3][9])
except:
 pass
try:
 g[2][9]=m(g[2][9],g[2][3]+g[3][9])
except:
 pass
try:
 g[3][9]=m(g[3][9],g[3][3]+g[3][9])
except:
 pass
try:
 g[4][9]=m(g[4][9],g[4][3]+g[3][9])
except:
 pass
try:
 g[5][9]=m(g[5][9],g[5][3]+g[3][9])
except:
 pass
try:
 g[6][9]=m(g[6][9],g[6][3]+g[3][9])
except:
 pass
try:
 g[7][9]=m(g[7][9],g[7][3]+g[3][9])
except:
 pass
try:
 g[8][9]=m(g[8][9],g[8][3]+g[3][9])
except:
 pass
try:
 g[9][9]=m(g[9][9],g[9][3]+g[3][9])
except:
 pass
try:
 g[0][0]=m(g[0][0],g[0][4]+g[4][0])
except:
 pass
try:
 g[1][0]=m(g[1][0],g[1][4]+g[4][0])
except:
 pass
try:
 g[2][0]=m(g[2][0],g[2][4]+g[4][0])
except:
 pass
try:
 g[3][0]=m(g[3][0],g[3][4]+g[4][0])
except:
 pass
try:
 g[4][0]=m(g[4][0],g[4][4]+g[4][0])
except:
 pass
try:
 g[5][0]=m(g[5][0],g[5][4]+g[4][0])
except:
 pass
try:
 g[6][0]=m(g[6][0],g[6][4]+g[4][0])
except:
 pass
try:
 g[7][0]=m(g[7][0],g[7][4]+g[4][0])
except:
 pass
try:
 g[8][0]=m(g[8][0],g[8][4]+g[4][0])
except:
 pass
try:
 g[9][0]=m(g[9][0],g[9][4]+g[4][0])
except:
 pass
try:
 g[0][1]=m(g[0][1],g[0][4]+g[4][1])
except:
 pass
try:
 g[1][1]=m(g[1][1],g[1][4]+g[4][1])
except:
 pass
try:
 g[2][1]=m(g[2][1],g[2][4]+g[4][1])
except:
 pass
try:
 g[3][1]=m(g[3][1],g[3][4]+g[4][1])
except:
 pass
try:
 g[4][1]=m(g[4][1],g[4][4]+g[4][1])
except:
 pass
try:
 g[5][1]=m(g[5][1],g[5][4]+g[4][1])
except:
 pass
try:
 g[6][1]=m(g[6][1],g[6][4]+g[4][1])
except:
 pass
try:
 g[7][1]=m(g[7][1],g[7][4]+g[4][1])
except:
 pass
try:
 g[8][1]=m(g[8][1],g[8][4]+g[4][1])
except:
 pass
try:
 g[9][1]=m(g[9][1],g[9][4]+g[4][1])
except:
 pass
try:
 g[0][2]=m(g[0][2],g[0][4]+g[4][2])
except:
 pass
try:
 g[1][2]=m(g[1][2],g[1][4]+g[4][2])
except:
 pass
try:
 g[2][2]=m(g[2][2],g[2][4]+g[4][2])
except:
 pass
try:
 g[3][2]=m(g[3][2],g[3][4]+g[4][2])
except:
 pass
try:
 g[4][2]=m(g[4][2],g[4][4]+g[4][2])
except:
 pass
try:
 g[5][2]=m(g[5][2],g[5][4]+g[4][2])
except:
 pass
try:
 g[6][2]=m(g[6][2],g[6][4]+g[4][2])
except:
 pass
try:
 g[7][2]=m(g[7][2],g[7][4]+g[4][2])
except:
 pass
try:
 g[8][2]=m(g[8][2],g[8][4]+g[4][2])
except:
 pass
try:
 g[9][2]=m(g[9][2],g[9][4]+g[4][2])
except:
 pass
try:
 g[0][3]=m(g[0][3],g[0][4]+g[4][3])
except:
 pass
try:
 g[1][3]=m(g[1][3],g[1][4]+g[4][3])
except:
 pass
try:
 g[2][3]=m(g[2][3],g[2][4]+g[4][3])
except:
 pass
try:
 g[3][3]=m(g[3][3],g[3][4]+g[4][3])
except:
 pass
try:
 g[4][3]=m(g[4][3],g[4][4]+g[4][3])
except:
 pass
try:
 g[5][3]=m(g[5][3],g[5][4]+g[4][3])
except:
 pass
try:
 g[6][3]=m(g[6][3],g[6][4]+g[4][3])
except:
 pass
try:
 g[7][3]=m(g[7][3],g[7][4]+g[4][3])
except:
 pass
try:
 g[8][3]=m(g[8][3],g[8][4]+g[4][3])
except:
 pass
try:
 g[9][3]=m(g[9][3],g[9][4]+g[4][3])
except:
 pass
try:
 g[0][4]=m(g[0][4],g[0][4]+g[4][4])
except:
 pass
try:
 g[1][4]=m(g[1][4],g[1][4]+g[4][4])
except:
 pass
try:
 g[2][4]=m(g[2][4],g[2][4]+g[4][4])
except:
 pass
try:
 g[3][4]=m(g[3][4],g[3][4]+g[4][4])
except:
 pass
try:
 g[4][4]=m(g[4][4],g[4][4]+g[4][4])
except:
 pass
try:
 g[5][4]=m(g[5][4],g[5][4]+g[4][4])
except:
 pass
try:
 g[6][4]=m(g[6][4],g[6][4]+g[4][4])
except:
 pass
try:
 g[7][4]=m(g[7][4],g[7][4]+g[4][4])
except:
 pass
try:
 g[8][4]=m(g[8][4],g[8][4]+g[4][4])
except:
 pass
try:
 g[9][4]=m(g[9][4],g[9][4]+g[4][4])
except:
 pass
try:
 g[0][5]=m(g[0][5],g[0][4]+g[4][5])
except:
 pass
try:
 g[1][5]=m(g[1][5],g[1][4]+g[4][5])
except:
 pass
try:
 g[2][5]=m(g[2][5],g[2][4]+g[4][5])
except:
 pass
try:
 g[3][5]=m(g[3][5],g[3][4]+g[4][5])
except:
 pass
try:
 g[4][5]=m(g[4][5],g[4][4]+g[4][5])
except:
 pass
try:
 g[5][5]=m(g[5][5],g[5][4]+g[4][5])
except:
 pass
try:
 g[6][5]=m(g[6][5],g[6][4]+g[4][5])
except:
 pass
try:
 g[7][5]=m(g[7][5],g[7][4]+g[4][5])
except:
 pass
try:
 g[8][5]=m(g[8][5],g[8][4]+g[4][5])
except:
 pass
try:
 g[9][5]=m(g[9][5],g[9][4]+g[4][5])
except:
 pass
try:
 g[0][6]=m(g[0][6],g[0][4]+g[4][6])
except:
 pass
try:
 g[1][6]=m(g[1][6],g[1][4]+g[4][6])
except:
 pass
try:
 g[2][6]=m(g[2][6],g[2][4]+g[4][6])
except:
 pass
try:
 g[3][6]=m(g[3][6],g[3][4]+g[4][6])
except:
 pass
try:
 g[4][6]=m(g[4][6],g[4][4]+g[4][6])
except:
 pass
try:
 g[5][6]=m(g[5][6],g[5][4]+g[4][6])
except:
 pass
try:
 g[6][6]=m(g[6][6],g[6][4]+g[4][6])
except:
 pass
try:
 g[7][6]=m(g[7][6],g[7][4]+g[4][6])
except:
 pass
try:
 g[8][6]=m(g[8][6],g[8][4]+g[4][6])
except:
 pass
try:
 g[9][6]=m(g[9][6],g[9][4]+g[4][6])
except:
 pass
try:
 g[0][7]=m(g[0][7],g[0][4]+g[4][7])
except:
 pass
try:
 g[1][7]=m(g[1][7],g[1][4]+g[4][7])
except:
 pass
try:
 g[2][7]=m(g[2][7],g[2][4]+g[4][7])
except:
 pass
try:
 g[3][7]=m(g[3][7],g[3][4]+g[4][7])
except:
 pass
try:
 g[4][7]=m(g[4][7],g[4][4]+g[4][7])
except:
 pass
try:
 g[5][7]=m(g[5][7],g[5][4]+g[4][7])
except:
 pass
try:
 g[6][7]=m(g[6][7],g[6][4]+g[4][7])
except:
 pass
try:
 g[7][7]=m(g[7][7],g[7][4]+g[4][7])
except:
 pass
try:
 g[8][7]=m(g[8][7],g[8][4]+g[4][7])
except:
 pass
try:
 g[9][7]=m(g[9][7],g[9][4]+g[4][7])
except:
 pass
try:
 g[0][8]=m(g[0][8],g[0][4]+g[4][8])
except:
 pass
try:
 g[1][8]=m(g[1][8],g[1][4]+g[4][8])
except:
 pass
try:
 g[2][8]=m(g[2][8],g[2][4]+g[4][8])
except:
 pass
try:
 g[3][8]=m(g[3][8],g[3][4]+g[4][8])
except:
 pass
try:
 g[4][8]=m(g[4][8],g[4][4]+g[4][8])
except:
 pass
try:
 g[5][8]=m(g[5][8],g[5][4]+g[4][8])
except:
 pass
try:
 g[6][8]=m(g[6][8],g[6][4]+g[4][8])
except:
 pass
try:
 g[7][8]=m(g[7][8],g[7][4]+g[4][8])
except:
 pass
try:
 g[8][8]=m(g[8][8],g[8][4]+g[4][8])
except:
 pass
try:
 g[9][8]=m(g[9][8],g[9][4]+g[4][8])
except:
 pass
try:
 g[0][9]=m(g[0][9],g[0][4]+g[4][9])
except:
 pass
try:
 g[1][9]=m(g[1][9],g[1][4]+g[4][9])
except:
 pass
try:
 g[2][9]=m(g[2][9],g[2][4]+g[4][9])
except:
 pass
try:
 g[3][9]=m(g[3][9],g[3][4]+g[4][9])
except:
 pass
try:
 g[4][9]=m(g[4][9],g[4][4]+g[4][9])
except:
 pass
try:
 g[5][9]=m(g[5][9],g[5][4]+g[4][9])
except:
 pass
try:
 g[6][9]=m(g[6][9],g[6][4]+g[4][9])
except:
 pass
try:
 g[7][9]=m(g[7][9],g[7][4]+g[4][9])
except:
 pass
try:
 g[8][9]=m(g[8][9],g[8][4]+g[4][9])
except:
 pass
try:
 g[9][9]=m(g[9][9],g[9][4]+g[4][9])
except:
 pass
try:
 g[0][0]=m(g[0][0],g[0][5]+g[5][0])
except:
 pass
try:
 g[1][0]=m(g[1][0],g[1][5]+g[5][0])
except:
 pass
try:
 g[2][0]=m(g[2][0],g[2][5]+g[5][0])
except:
 pass
try:
 g[3][0]=m(g[3][0],g[3][5]+g[5][0])
except:
 pass
try:
 g[4][0]=m(g[4][0],g[4][5]+g[5][0])
except:
 pass
try:
 g[5][0]=m(g[5][0],g[5][5]+g[5][0])
except:
 pass
try:
 g[6][0]=m(g[6][0],g[6][5]+g[5][0])
except:
 pass
try:
 g[7][0]=m(g[7][0],g[7][5]+g[5][0])
except:
 pass
try:
 g[8][0]=m(g[8][0],g[8][5]+g[5][0])
except:
 pass
try:
 g[9][0]=m(g[9][0],g[9][5]+g[5][0])
except:
 pass
try:
 g[0][1]=m(g[0][1],g[0][5]+g[5][1])
except:
 pass
try:
 g[1][1]=m(g[1][1],g[1][5]+g[5][1])
except:
 pass
try:
 g[2][1]=m(g[2][1],g[2][5]+g[5][1])
except:
 pass
try:
 g[3][1]=m(g[3][1],g[3][5]+g[5][1])
except:
 pass
try:
 g[4][1]=m(g[4][1],g[4][5]+g[5][1])
except:
 pass
try:
 g[5][1]=m(g[5][1],g[5][5]+g[5][1])
except:
 pass
try:
 g[6][1]=m(g[6][1],g[6][5]+g[5][1])
except:
 pass
try:
 g[7][1]=m(g[7][1],g[7][5]+g[5][1])
except:
 pass
try:
 g[8][1]=m(g[8][1],g[8][5]+g[5][1])
except:
 pass
try:
 g[9][1]=m(g[9][1],g[9][5]+g[5][1])
except:
 pass
try:
 g[0][2]=m(g[0][2],g[0][5]+g[5][2])
except:
 pass
try:
 g[1][2]=m(g[1][2],g[1][5]+g[5][2])
except:
 pass
try:
 g[2][2]=m(g[2][2],g[2][5]+g[5][2])
except:
 pass
try:
 g[3][2]=m(g[3][2],g[3][5]+g[5][2])
except:
 pass
try:
 g[4][2]=m(g[4][2],g[4][5]+g[5][2])
except:
 pass
try:
 g[5][2]=m(g[5][2],g[5][5]+g[5][2])
except:
 pass
try:
 g[6][2]=m(g[6][2],g[6][5]+g[5][2])
except:
 pass
try:
 g[7][2]=m(g[7][2],g[7][5]+g[5][2])
except:
 pass
try:
 g[8][2]=m(g[8][2],g[8][5]+g[5][2])
except:
 pass
try:
 g[9][2]=m(g[9][2],g[9][5]+g[5][2])
except:
 pass
try:
 g[0][3]=m(g[0][3],g[0][5]+g[5][3])
except:
 pass
try:
 g[1][3]=m(g[1][3],g[1][5]+g[5][3])
except:
 pass
try:
 g[2][3]=m(g[2][3],g[2][5]+g[5][3])
except:
 pass
try:
 g[3][3]=m(g[3][3],g[3][5]+g[5][3])
except:
 pass
try:
 g[4][3]=m(g[4][3],g[4][5]+g[5][3])
except:
 pass
try:
 g[5][3]=m(g[5][3],g[5][5]+g[5][3])
except:
 pass
try:
 g[6][3]=m(g[6][3],g[6][5]+g[5][3])
except:
 pass
try:
 g[7][3]=m(g[7][3],g[7][5]+g[5][3])
except:
 pass
try:
 g[8][3]=m(g[8][3],g[8][5]+g[5][3])
except:
 pass
try:
 g[9][3]=m(g[9][3],g[9][5]+g[5][3])
except:
 pass
try:
 g[0][4]=m(g[0][4],g[0][5]+g[5][4])
except:
 pass
try:
 g[1][4]=m(g[1][4],g[1][5]+g[5][4])
except:
 pass
try:
 g[2][4]=m(g[2][4],g[2][5]+g[5][4])
except:
 pass
try:
 g[3][4]=m(g[3][4],g[3][5]+g[5][4])
except:
 pass
try:
 g[4][4]=m(g[4][4],g[4][5]+g[5][4])
except:
 pass
try:
 g[5][4]=m(g[5][4],g[5][5]+g[5][4])
except:
 pass
try:
 g[6][4]=m(g[6][4],g[6][5]+g[5][4])
except:
 pass
try:
 g[7][4]=m(g[7][4],g[7][5]+g[5][4])
except:
 pass
try:
 g[8][4]=m(g[8][4],g[8][5]+g[5][4])
except:
 pass
try:
 g[9][4]=m(g[9][4],g[9][5]+g[5][4])
except:
 pass
try:
 g[0][5]=m(g[0][5],g[0][5]+g[5][5])
except:
 pass
try:
 g[1][5]=m(g[1][5],g[1][5]+g[5][5])
except:
 pass
try:
 g[2][5]=m(g[2][5],g[2][5]+g[5][5])
except:
 pass
try:
 g[3][5]=m(g[3][5],g[3][5]+g[5][5])
except:
 pass
try:
 g[4][5]=m(g[4][5],g[4][5]+g[5][5])
except:
 pass
try:
 g[5][5]=m(g[5][5],g[5][5]+g[5][5])
except:
 pass
try:
 g[6][5]=m(g[6][5],g[6][5]+g[5][5])
except:
 pass
try:
 g[7][5]=m(g[7][5],g[7][5]+g[5][5])
except:
 pass
try:
 g[8][5]=m(g[8][5],g[8][5]+g[5][5])
except:
 pass
try:
 g[9][5]=m(g[9][5],g[9][5]+g[5][5])
except:
 pass
try:
 g[0][6]=m(g[0][6],g[0][5]+g[5][6])
except:
 pass
try:
 g[1][6]=m(g[1][6],g[1][5]+g[5][6])
except:
 pass
try:
 g[2][6]=m(g[2][6],g[2][5]+g[5][6])
except:
 pass
try:
 g[3][6]=m(g[3][6],g[3][5]+g[5][6])
except:
 pass
try:
 g[4][6]=m(g[4][6],g[4][5]+g[5][6])
except:
 pass
try:
 g[5][6]=m(g[5][6],g[5][5]+g[5][6])
except:
 pass
try:
 g[6][6]=m(g[6][6],g[6][5]+g[5][6])
except:
 pass
try:
 g[7][6]=m(g[7][6],g[7][5]+g[5][6])
except:
 pass
try:
 g[8][6]=m(g[8][6],g[8][5]+g[5][6])
except:
 pass
try:
 g[9][6]=m(g[9][6],g[9][5]+g[5][6])
except:
 pass
try:
 g[0][7]=m(g[0][7],g[0][5]+g[5][7])
except:
 pass
try:
 g[1][7]=m(g[1][7],g[1][5]+g[5][7])
except:
 pass
try:
 g[2][7]=m(g[2][7],g[2][5]+g[5][7])
except:
 pass
try:
 g[3][7]=m(g[3][7],g[3][5]+g[5][7])
except:
 pass
try:
 g[4][7]=m(g[4][7],g[4][5]+g[5][7])
except:
 pass
try:
 g[5][7]=m(g[5][7],g[5][5]+g[5][7])
except:
 pass
try:
 g[6][7]=m(g[6][7],g[6][5]+g[5][7])
except:
 pass
try:
 g[7][7]=m(g[7][7],g[7][5]+g[5][7])
except:
 pass
try:
 g[8][7]=m(g[8][7],g[8][5]+g[5][7])
except:
 pass
try:
 g[9][7]=m(g[9][7],g[9][5]+g[5][7])
except:
 pass
try:
 g[0][8]=m(g[0][8],g[0][5]+g[5][8])
except:
 pass
try:
 g[1][8]=m(g[1][8],g[1][5]+g[5][8])
except:
 pass
try:
 g[2][8]=m(g[2][8],g[2][5]+g[5][8])
except:
 pass
try:
 g[3][8]=m(g[3][8],g[3][5]+g[5][8])
except:
 pass
try:
 g[4][8]=m(g[4][8],g[4][5]+g[5][8])
except:
 pass
try:
 g[5][8]=m(g[5][8],g[5][5]+g[5][8])
except:
 pass
try:
 g[6][8]=m(g[6][8],g[6][5]+g[5][8])
except:
 pass
try:
 g[7][8]=m(g[7][8],g[7][5]+g[5][8])
except:
 pass
try:
 g[8][8]=m(g[8][8],g[8][5]+g[5][8])
except:
 pass
try:
 g[9][8]=m(g[9][8],g[9][5]+g[5][8])
except:
 pass
try:
 g[0][9]=m(g[0][9],g[0][5]+g[5][9])
except:
 pass
try:
 g[1][9]=m(g[1][9],g[1][5]+g[5][9])
except:
 pass
try:
 g[2][9]=m(g[2][9],g[2][5]+g[5][9])
except:
 pass
try:
 g[3][9]=m(g[3][9],g[3][5]+g[5][9])
except:
 pass
try:
 g[4][9]=m(g[4][9],g[4][5]+g[5][9])
except:
 pass
try:
 g[5][9]=m(g[5][9],g[5][5]+g[5][9])
except:
 pass
try:
 g[6][9]=m(g[6][9],g[6][5]+g[5][9])
except:
 pass
try:
 g[7][9]=m(g[7][9],g[7][5]+g[5][9])
except:
 pass
try:
 g[8][9]=m(g[8][9],g[8][5]+g[5][9])
except:
 pass
try:
 g[9][9]=m(g[9][9],g[9][5]+g[5][9])
except:
 pass
try:
 g[0][0]=m(g[0][0],g[0][6]+g[6][0])
except:
 pass
try:
 g[1][0]=m(g[1][0],g[1][6]+g[6][0])
except:
 pass
try:
 g[2][0]=m(g[2][0],g[2][6]+g[6][0])
except:
 pass
try:
 g[3][0]=m(g[3][0],g[3][6]+g[6][0])
except:
 pass
try:
 g[4][0]=m(g[4][0],g[4][6]+g[6][0])
except:
 pass
try:
 g[5][0]=m(g[5][0],g[5][6]+g[6][0])
except:
 pass
try:
 g[6][0]=m(g[6][0],g[6][6]+g[6][0])
except:
 pass
try:
 g[7][0]=m(g[7][0],g[7][6]+g[6][0])
except:
 pass
try:
 g[8][0]=m(g[8][0],g[8][6]+g[6][0])
except:
 pass
try:
 g[9][0]=m(g[9][0],g[9][6]+g[6][0])
except:
 pass
try:
 g[0][1]=m(g[0][1],g[0][6]+g[6][1])
except:
 pass
try:
 g[1][1]=m(g[1][1],g[1][6]+g[6][1])
except:
 pass
try:
 g[2][1]=m(g[2][1],g[2][6]+g[6][1])
except:
 pass
try:
 g[3][1]=m(g[3][1],g[3][6]+g[6][1])
except:
 pass
try:
 g[4][1]=m(g[4][1],g[4][6]+g[6][1])
except:
 pass
try:
 g[5][1]=m(g[5][1],g[5][6]+g[6][1])
except:
 pass
try:
 g[6][1]=m(g[6][1],g[6][6]+g[6][1])
except:
 pass
try:
 g[7][1]=m(g[7][1],g[7][6]+g[6][1])
except:
 pass
try:
 g[8][1]=m(g[8][1],g[8][6]+g[6][1])
except:
 pass
try:
 g[9][1]=m(g[9][1],g[9][6]+g[6][1])
except:
 pass
try:
 g[0][2]=m(g[0][2],g[0][6]+g[6][2])
except:
 pass
try:
 g[1][2]=m(g[1][2],g[1][6]+g[6][2])
except:
 pass
try:
 g[2][2]=m(g[2][2],g[2][6]+g[6][2])
except:
 pass
try:
 g[3][2]=m(g[3][2],g[3][6]+g[6][2])
except:
 pass
try:
 g[4][2]=m(g[4][2],g[4][6]+g[6][2])
except:
 pass
try:
 g[5][2]=m(g[5][2],g[5][6]+g[6][2])
except:
 pass
try:
 g[6][2]=m(g[6][2],g[6][6]+g[6][2])
except:
 pass
try:
 g[7][2]=m(g[7][2],g[7][6]+g[6][2])
except:
 pass
try:
 g[8][2]=m(g[8][2],g[8][6]+g[6][2])
except:
 pass
try:
 g[9][2]=m(g[9][2],g[9][6]+g[6][2])
except:
 pass
try:
 g[0][3]=m(g[0][3],g[0][6]+g[6][3])
except:
 pass
try:
 g[1][3]=m(g[1][3],g[1][6]+g[6][3])
except:
 pass
try:
 g[2][3]=m(g[2][3],g[2][6]+g[6][3])
except:
 pass
try:
 g[3][3]=m(g[3][3],g[3][6]+g[6][3])
except:
 pass
try:
 g[4][3]=m(g[4][3],g[4][6]+g[6][3])
except:
 pass
try:
 g[5][3]=m(g[5][3],g[5][6]+g[6][3])
except:
 pass
try:
 g[6][3]=m(g[6][3],g[6][6]+g[6][3])
except:
 pass
try:
 g[7][3]=m(g[7][3],g[7][6]+g[6][3])
except:
 pass
try:
 g[8][3]=m(g[8][3],g[8][6]+g[6][3])
except:
 pass
try:
 g[9][3]=m(g[9][3],g[9][6]+g[6][3])
except:
 pass
try:
 g[0][4]=m(g[0][4],g[0][6]+g[6][4])
except:
 pass
try:
 g[1][4]=m(g[1][4],g[1][6]+g[6][4])
except:
 pass
try:
 g[2][4]=m(g[2][4],g[2][6]+g[6][4])
except:
 pass
try:
 g[3][4]=m(g[3][4],g[3][6]+g[6][4])
except:
 pass
try:
 g[4][4]=m(g[4][4],g[4][6]+g[6][4])
except:
 pass
try:
 g[5][4]=m(g[5][4],g[5][6]+g[6][4])
except:
 pass
try:
 g[6][4]=m(g[6][4],g[6][6]+g[6][4])
except:
 pass
try:
 g[7][4]=m(g[7][4],g[7][6]+g[6][4])
except:
 pass
try:
 g[8][4]=m(g[8][4],g[8][6]+g[6][4])
except:
 pass
try:
 g[9][4]=m(g[9][4],g[9][6]+g[6][4])
except:
 pass
try:
 g[0][5]=m(g[0][5],g[0][6]+g[6][5])
except:
 pass
try:
 g[1][5]=m(g[1][5],g[1][6]+g[6][5])
except:
 pass
try:
 g[2][5]=m(g[2][5],g[2][6]+g[6][5])
except:
 pass
try:
 g[3][5]=m(g[3][5],g[3][6]+g[6][5])
except:
 pass
try:
 g[4][5]=m(g[4][5],g[4][6]+g[6][5])
except:
 pass
try:
 g[5][5]=m(g[5][5],g[5][6]+g[6][5])
except:
 pass
try:
 g[6][5]=m(g[6][5],g[6][6]+g[6][5])
except:
 pass
try:
 g[7][5]=m(g[7][5],g[7][6]+g[6][5])
except:
 pass
try:
 g[8][5]=m(g[8][5],g[8][6]+g[6][5])
except:
 pass
try:
 g[9][5]=m(g[9][5],g[9][6]+g[6][5])
except:
 pass
try:
 g[0][6]=m(g[0][6],g[0][6]+g[6][6])
except:
 pass
try:
 g[1][6]=m(g[1][6],g[1][6]+g[6][6])
except:
 pass
try:
 g[2][6]=m(g[2][6],g[2][6]+g[6][6])
except:
 pass
try:
 g[3][6]=m(g[3][6],g[3][6]+g[6][6])
except:
 pass
try:
 g[4][6]=m(g[4][6],g[4][6]+g[6][6])
except:
 pass
try:
 g[5][6]=m(g[5][6],g[5][6]+g[6][6])
except:
 pass
try:
 g[6][6]=m(g[6][6],g[6][6]+g[6][6])
except:
 pass
try:
 g[7][6]=m(g[7][6],g[7][6]+g[6][6])
except:
 pass
try:
 g[8][6]=m(g[8][6],g[8][6]+g[6][6])
except:
 pass
try:
 g[9][6]=m(g[9][6],g[9][6]+g[6][6])
except:
 pass
try:
 g[0][7]=m(g[0][7],g[0][6]+g[6][7])
except:
 pass
try:
 g[1][7]=m(g[1][7],g[1][6]+g[6][7])
except:
 pass
try:
 g[2][7]=m(g[2][7],g[2][6]+g[6][7])
except:
 pass
try:
 g[3][7]=m(g[3][7],g[3][6]+g[6][7])
except:
 pass
try:
 g[4][7]=m(g[4][7],g[4][6]+g[6][7])
except:
 pass
try:
 g[5][7]=m(g[5][7],g[5][6]+g[6][7])
except:
 pass
try:
 g[6][7]=m(g[6][7],g[6][6]+g[6][7])
except:
 pass
try:
 g[7][7]=m(g[7][7],g[7][6]+g[6][7])
except:
 pass
try:
 g[8][7]=m(g[8][7],g[8][6]+g[6][7])
except:
 pass
try:
 g[9][7]=m(g[9][7],g[9][6]+g[6][7])
except:
 pass
try:
 g[0][8]=m(g[0][8],g[0][6]+g[6][8])
except:
 pass
try:
 g[1][8]=m(g[1][8],g[1][6]+g[6][8])
except:
 pass
try:
 g[2][8]=m(g[2][8],g[2][6]+g[6][8])
except:
 pass
try:
 g[3][8]=m(g[3][8],g[3][6]+g[6][8])
except:
 pass
try:
 g[4][8]=m(g[4][8],g[4][6]+g[6][8])
except:
 pass
try:
 g[5][8]=m(g[5][8],g[5][6]+g[6][8])
except:
 pass
try:
 g[6][8]=m(g[6][8],g[6][6]+g[6][8])
except:
 pass
try:
 g[7][8]=m(g[7][8],g[7][6]+g[6][8])
except:
 pass
try:
 g[8][8]=m(g[8][8],g[8][6]+g[6][8])
except:
 pass
try:
 g[9][8]=m(g[9][8],g[9][6]+g[6][8])
except:
 pass
try:
 g[0][9]=m(g[0][9],g[0][6]+g[6][9])
except:
 pass
try:
 g[1][9]=m(g[1][9],g[1][6]+g[6][9])
except:
 pass
try:
 g[2][9]=m(g[2][9],g[2][6]+g[6][9])
except:
 pass
try:
 g[3][9]=m(g[3][9],g[3][6]+g[6][9])
except:
 pass
try:
 g[4][9]=m(g[4][9],g[4][6]+g[6][9])
except:
 pass
try:
 g[5][9]=m(g[5][9],g[5][6]+g[6][9])
except:
 pass
try:
 g[6][9]=m(g[6][9],g[6][6]+g[6][9])
except:
 pass
try:
 g[7][9]=m(g[7][9],g[7][6]+g[6][9])
except:
 pass
try:
 g[8][9]=m(g[8][9],g[8][6]+g[6][9])
except:
 pass
try:
 g[9][9]=m(g[9][9],g[9][6]+g[6][9])
except:
 pass
try:
 g[0][0]=m(g[0][0],g[0][7]+g[7][0])
except:
 pass
try:
 g[1][0]=m(g[1][0],g[1][7]+g[7][0])
except:
 pass
try:
 g[2][0]=m(g[2][0],g[2][7]+g[7][0])
except:
 pass
try:
 g[3][0]=m(g[3][0],g[3][7]+g[7][0])
except:
 pass
try:
 g[4][0]=m(g[4][0],g[4][7]+g[7][0])
except:
 pass
try:
 g[5][0]=m(g[5][0],g[5][7]+g[7][0])
except:
 pass
try:
 g[6][0]=m(g[6][0],g[6][7]+g[7][0])
except:
 pass
try:
 g[7][0]=m(g[7][0],g[7][7]+g[7][0])
except:
 pass
try:
 g[8][0]=m(g[8][0],g[8][7]+g[7][0])
except:
 pass
try:
 g[9][0]=m(g[9][0],g[9][7]+g[7][0])
except:
 pass
try:
 g[0][1]=m(g[0][1],g[0][7]+g[7][1])
except:
 pass
try:
 g[1][1]=m(g[1][1],g[1][7]+g[7][1])
except:
 pass
try:
 g[2][1]=m(g[2][1],g[2][7]+g[7][1])
except:
 pass
try:
 g[3][1]=m(g[3][1],g[3][7]+g[7][1])
except:
 pass
try:
 g[4][1]=m(g[4][1],g[4][7]+g[7][1])
except:
 pass
try:
 g[5][1]=m(g[5][1],g[5][7]+g[7][1])
except:
 pass
try:
 g[6][1]=m(g[6][1],g[6][7]+g[7][1])
except:
 pass
try:
 g[7][1]=m(g[7][1],g[7][7]+g[7][1])
except:
 pass
try:
 g[8][1]=m(g[8][1],g[8][7]+g[7][1])
except:
 pass
try:
 g[9][1]=m(g[9][1],g[9][7]+g[7][1])
except:
 pass
try:
 g[0][2]=m(g[0][2],g[0][7]+g[7][2])
except:
 pass
try:
 g[1][2]=m(g[1][2],g[1][7]+g[7][2])
except:
 pass
try:
 g[2][2]=m(g[2][2],g[2][7]+g[7][2])
except:
 pass
try:
 g[3][2]=m(g[3][2],g[3][7]+g[7][2])
except:
 pass
try:
 g[4][2]=m(g[4][2],g[4][7]+g[7][2])
except:
 pass
try:
 g[5][2]=m(g[5][2],g[5][7]+g[7][2])
except:
 pass
try:
 g[6][2]=m(g[6][2],g[6][7]+g[7][2])
except:
 pass
try:
 g[7][2]=m(g[7][2],g[7][7]+g[7][2])
except:
 pass
try:
 g[8][2]=m(g[8][2],g[8][7]+g[7][2])
except:
 pass
try:
 g[9][2]=m(g[9][2],g[9][7]+g[7][2])
except:
 pass
try:
 g[0][3]=m(g[0][3],g[0][7]+g[7][3])
except:
 pass
try:
 g[1][3]=m(g[1][3],g[1][7]+g[7][3])
except:
 pass
try:
 g[2][3]=m(g[2][3],g[2][7]+g[7][3])
except:
 pass
try:
 g[3][3]=m(g[3][3],g[3][7]+g[7][3])
except:
 pass
try:
 g[4][3]=m(g[4][3],g[4][7]+g[7][3])
except:
 pass
try:
 g[5][3]=m(g[5][3],g[5][7]+g[7][3])
except:
 pass
try:
 g[6][3]=m(g[6][3],g[6][7]+g[7][3])
except:
 pass
try:
 g[7][3]=m(g[7][3],g[7][7]+g[7][3])
except:
 pass
try:
 g[8][3]=m(g[8][3],g[8][7]+g[7][3])
except:
 pass
try:
 g[9][3]=m(g[9][3],g[9][7]+g[7][3])
except:
 pass
try:
 g[0][4]=m(g[0][4],g[0][7]+g[7][4])
except:
 pass
try:
 g[1][4]=m(g[1][4],g[1][7]+g[7][4])
except:
 pass
try:
 g[2][4]=m(g[2][4],g[2][7]+g[7][4])
except:
 pass
try:
 g[3][4]=m(g[3][4],g[3][7]+g[7][4])
except:
 pass
try:
 g[4][4]=m(g[4][4],g[4][7]+g[7][4])
except:
 pass
try:
 g[5][4]=m(g[5][4],g[5][7]+g[7][4])
except:
 pass
try:
 g[6][4]=m(g[6][4],g[6][7]+g[7][4])
except:
 pass
try:
 g[7][4]=m(g[7][4],g[7][7]+g[7][4])
except:
 pass
try:
 g[8][4]=m(g[8][4],g[8][7]+g[7][4])
except:
 pass
try:
 g[9][4]=m(g[9][4],g[9][7]+g[7][4])
except:
 pass
try:
 g[0][5]=m(g[0][5],g[0][7]+g[7][5])
except:
 pass
try:
 g[1][5]=m(g[1][5],g[1][7]+g[7][5])
except:
 pass
try:
 g[2][5]=m(g[2][5],g[2][7]+g[7][5])
except:
 pass
try:
 g[3][5]=m(g[3][5],g[3][7]+g[7][5])
except:
 pass
try:
 g[4][5]=m(g[4][5],g[4][7]+g[7][5])
except:
 pass
try:
 g[5][5]=m(g[5][5],g[5][7]+g[7][5])
except:
 pass
try:
 g[6][5]=m(g[6][5],g[6][7]+g[7][5])
except:
 pass
try:
 g[7][5]=m(g[7][5],g[7][7]+g[7][5])
except:
 pass
try:
 g[8][5]=m(g[8][5],g[8][7]+g[7][5])
except:
 pass
try:
 g[9][5]=m(g[9][5],g[9][7]+g[7][5])
except:
 pass
try:
 g[0][6]=m(g[0][6],g[0][7]+g[7][6])
except:
 pass
try:
 g[1][6]=m(g[1][6],g[1][7]+g[7][6])
except:
 pass
try:
 g[2][6]=m(g[2][6],g[2][7]+g[7][6])
except:
 pass
try:
 g[3][6]=m(g[3][6],g[3][7]+g[7][6])
except:
 pass
try:
 g[4][6]=m(g[4][6],g[4][7]+g[7][6])
except:
 pass
try:
 g[5][6]=m(g[5][6],g[5][7]+g[7][6])
except:
 pass
try:
 g[6][6]=m(g[6][6],g[6][7]+g[7][6])
except:
 pass
try:
 g[7][6]=m(g[7][6],g[7][7]+g[7][6])
except:
 pass
try:
 g[8][6]=m(g[8][6],g[8][7]+g[7][6])
except:
 pass
try:
 g[9][6]=m(g[9][6],g[9][7]+g[7][6])
except:
 pass
try:
 g[0][7]=m(g[0][7],g[0][7]+g[7][7])
except:
 pass
try:
 g[1][7]=m(g[1][7],g[1][7]+g[7][7])
except:
 pass
try:
 g[2][7]=m(g[2][7],g[2][7]+g[7][7])
except:
 pass
try:
 g[3][7]=m(g[3][7],g[3][7]+g[7][7])
except:
 pass
try:
 g[4][7]=m(g[4][7],g[4][7]+g[7][7])
except:
 pass
try:
 g[5][7]=m(g[5][7],g[5][7]+g[7][7])
except:
 pass
try:
 g[6][7]=m(g[6][7],g[6][7]+g[7][7])
except:
 pass
try:
 g[7][7]=m(g[7][7],g[7][7]+g[7][7])
except:
 pass
try:
 g[8][7]=m(g[8][7],g[8][7]+g[7][7])
except:
 pass
try:
 g[9][7]=m(g[9][7],g[9][7]+g[7][7])
except:
 pass
try:
 g[0][8]=m(g[0][8],g[0][7]+g[7][8])
except:
 pass
try:
 g[1][8]=m(g[1][8],g[1][7]+g[7][8])
except:
 pass
try:
 g[2][8]=m(g[2][8],g[2][7]+g[7][8])
except:
 pass
try:
 g[3][8]=m(g[3][8],g[3][7]+g[7][8])
except:
 pass
try:
 g[4][8]=m(g[4][8],g[4][7]+g[7][8])
except:
 pass
try:
 g[5][8]=m(g[5][8],g[5][7]+g[7][8])
except:
 pass
try:
 g[6][8]=m(g[6][8],g[6][7]+g[7][8])
except:
 pass
try:
 g[7][8]=m(g[7][8],g[7][7]+g[7][8])
except:
 pass
try:
 g[8][8]=m(g[8][8],g[8][7]+g[7][8])
except:
 pass
try:
 g[9][8]=m(g[9][8],g[9][7]+g[7][8])
except:
 pass
try:
 g[0][9]=m(g[0][9],g[0][7]+g[7][9])
except:
 pass
try:
 g[1][9]=m(g[1][9],g[1][7]+g[7][9])
except:
 pass
try:
 g[2][9]=m(g[2][9],g[2][7]+g[7][9])
except:
 pass
try:
 g[3][9]=m(g[3][9],g[3][7]+g[7][9])
except:
 pass
try:
 g[4][9]=m(g[4][9],g[4][7]+g[7][9])
except:
 pass
try:
 g[5][9]=m(g[5][9],g[5][7]+g[7][9])
except:
 pass
try:
 g[6][9]=m(g[6][9],g[6][7]+g[7][9])
except:
 pass
try:
 g[7][9]=m(g[7][9],g[7][7]+g[7][9])
except:
 pass
try:
 g[8][9]=m(g[8][9],g[8][7]+g[7][9])
except:
 pass
try:
 g[9][9]=m(g[9][9],g[9][7]+g[7][9])
except:
 pass
try:
 g[0][0]=m(g[0][0],g[0][8]+g[8][0])
except:
 pass
try:
 g[1][0]=m(g[1][0],g[1][8]+g[8][0])
except:
 pass
try:
 g[2][0]=m(g[2][0],g[2][8]+g[8][0])
except:
 pass
try:
 g[3][0]=m(g[3][0],g[3][8]+g[8][0])
except:
 pass
try:
 g[4][0]=m(g[4][0],g[4][8]+g[8][0])
except:
 pass
try:
 g[5][0]=m(g[5][0],g[5][8]+g[8][0])
except:
 pass
try:
 g[6][0]=m(g[6][0],g[6][8]+g[8][0])
except:
 pass
try:
 g[7][0]=m(g[7][0],g[7][8]+g[8][0])
except:
 pass
try:
 g[8][0]=m(g[8][0],g[8][8]+g[8][0])
except:
 pass
try:
 g[9][0]=m(g[9][0],g[9][8]+g[8][0])
except:
 pass
try:
 g[0][1]=m(g[0][1],g[0][8]+g[8][1])
except:
 pass
try:
 g[1][1]=m(g[1][1],g[1][8]+g[8][1])
except:
 pass
try:
 g[2][1]=m(g[2][1],g[2][8]+g[8][1])
except:
 pass
try:
 g[3][1]=m(g[3][1],g[3][8]+g[8][1])
except:
 pass
try:
 g[4][1]=m(g[4][1],g[4][8]+g[8][1])
except:
 pass
try:
 g[5][1]=m(g[5][1],g[5][8]+g[8][1])
except:
 pass
try:
 g[6][1]=m(g[6][1],g[6][8]+g[8][1])
except:
 pass
try:
 g[7][1]=m(g[7][1],g[7][8]+g[8][1])
except:
 pass
try:
 g[8][1]=m(g[8][1],g[8][8]+g[8][1])
except:
 pass
try:
 g[9][1]=m(g[9][1],g[9][8]+g[8][1])
except:
 pass
try:
 g[0][2]=m(g[0][2],g[0][8]+g[8][2])
except:
 pass
try:
 g[1][2]=m(g[1][2],g[1][8]+g[8][2])
except:
 pass
try:
 g[2][2]=m(g[2][2],g[2][8]+g[8][2])
except:
 pass
try:
 g[3][2]=m(g[3][2],g[3][8]+g[8][2])
except:
 pass
try:
 g[4][2]=m(g[4][2],g[4][8]+g[8][2])
except:
 pass
try:
 g[5][2]=m(g[5][2],g[5][8]+g[8][2])
except:
 pass
try:
 g[6][2]=m(g[6][2],g[6][8]+g[8][2])
except:
 pass
try:
 g[7][2]=m(g[7][2],g[7][8]+g[8][2])
except:
 pass
try:
 g[8][2]=m(g[8][2],g[8][8]+g[8][2])
except:
 pass
try:
 g[9][2]=m(g[9][2],g[9][8]+g[8][2])
except:
 pass
try:
 g[0][3]=m(g[0][3],g[0][8]+g[8][3])
except:
 pass
try:
 g[1][3]=m(g[1][3],g[1][8]+g[8][3])
except:
 pass
try:
 g[2][3]=m(g[2][3],g[2][8]+g[8][3])
except:
 pass
try:
 g[3][3]=m(g[3][3],g[3][8]+g[8][3])
except:
 pass
try:
 g[4][3]=m(g[4][3],g[4][8]+g[8][3])
except:
 pass
try:
 g[5][3]=m(g[5][3],g[5][8]+g[8][3])
except:
 pass
try:
 g[6][3]=m(g[6][3],g[6][8]+g[8][3])
except:
 pass
try:
 g[7][3]=m(g[7][3],g[7][8]+g[8][3])
except:
 pass
try:
 g[8][3]=m(g[8][3],g[8][8]+g[8][3])
except:
 pass
try:
 g[9][3]=m(g[9][3],g[9][8]+g[8][3])
except:
 pass
try:
 g[0][4]=m(g[0][4],g[0][8]+g[8][4])
except:
 pass
try:
 g[1][4]=m(g[1][4],g[1][8]+g[8][4])
except:
 pass
try:
 g[2][4]=m(g[2][4],g[2][8]+g[8][4])
except:
 pass
try:
 g[3][4]=m(g[3][4],g[3][8]+g[8][4])
except:
 pass
try:
 g[4][4]=m(g[4][4],g[4][8]+g[8][4])
except:
 pass
try:
 g[5][4]=m(g[5][4],g[5][8]+g[8][4])
except:
 pass
try:
 g[6][4]=m(g[6][4],g[6][8]+g[8][4])
except:
 pass
try:
 g[7][4]=m(g[7][4],g[7][8]+g[8][4])
except:
 pass
try:
 g[8][4]=m(g[8][4],g[8][8]+g[8][4])
except:
 pass
try:
 g[9][4]=m(g[9][4],g[9][8]+g[8][4])
except:
 pass
try:
 g[0][5]=m(g[0][5],g[0][8]+g[8][5])
except:
 pass
try:
 g[1][5]=m(g[1][5],g[1][8]+g[8][5])
except:
 pass
try:
 g[2][5]=m(g[2][5],g[2][8]+g[8][5])
except:
 pass
try:
 g[3][5]=m(g[3][5],g[3][8]+g[8][5])
except:
 pass
try:
 g[4][5]=m(g[4][5],g[4][8]+g[8][5])
except:
 pass
try:
 g[5][5]=m(g[5][5],g[5][8]+g[8][5])
except:
 pass
try:
 g[6][5]=m(g[6][5],g[6][8]+g[8][5])
except:
 pass
try:
 g[7][5]=m(g[7][5],g[7][8]+g[8][5])
except:
 pass
try:
 g[8][5]=m(g[8][5],g[8][8]+g[8][5])
except:
 pass
try:
 g[9][5]=m(g[9][5],g[9][8]+g[8][5])
except:
 pass
try:
 g[0][6]=m(g[0][6],g[0][8]+g[8][6])
except:
 pass
try:
 g[1][6]=m(g[1][6],g[1][8]+g[8][6])
except:
 pass
try:
 g[2][6]=m(g[2][6],g[2][8]+g[8][6])
except:
 pass
try:
 g[3][6]=m(g[3][6],g[3][8]+g[8][6])
except:
 pass
try:
 g[4][6]=m(g[4][6],g[4][8]+g[8][6])
except:
 pass
try:
 g[5][6]=m(g[5][6],g[5][8]+g[8][6])
except:
 pass
try:
 g[6][6]=m(g[6][6],g[6][8]+g[8][6])
except:
 pass
try:
 g[7][6]=m(g[7][6],g[7][8]+g[8][6])
except:
 pass
try:
 g[8][6]=m(g[8][6],g[8][8]+g[8][6])
except:
 pass
try:
 g[9][6]=m(g[9][6],g[9][8]+g[8][6])
except:
 pass
try:
 g[0][7]=m(g[0][7],g[0][8]+g[8][7])
except:
 pass
try:
 g[1][7]=m(g[1][7],g[1][8]+g[8][7])
except:
 pass
try:
 g[2][7]=m(g[2][7],g[2][8]+g[8][7])
except:
 pass
try:
 g[3][7]=m(g[3][7],g[3][8]+g[8][7])
except:
 pass
try:
 g[4][7]=m(g[4][7],g[4][8]+g[8][7])
except:
 pass
try:
 g[5][7]=m(g[5][7],g[5][8]+g[8][7])
except:
 pass
try:
 g[6][7]=m(g[6][7],g[6][8]+g[8][7])
except:
 pass
try:
 g[7][7]=m(g[7][7],g[7][8]+g[8][7])
except:
 pass
try:
 g[8][7]=m(g[8][7],g[8][8]+g[8][7])
except:
 pass
try:
 g[9][7]=m(g[9][7],g[9][8]+g[8][7])
except:
 pass
try:
 g[0][8]=m(g[0][8],g[0][8]+g[8][8])
except:
 pass
try:
 g[1][8]=m(g[1][8],g[1][8]+g[8][8])
except:
 pass
try:
 g[2][8]=m(g[2][8],g[2][8]+g[8][8])
except:
 pass
try:
 g[3][8]=m(g[3][8],g[3][8]+g[8][8])
except:
 pass
try:
 g[4][8]=m(g[4][8],g[4][8]+g[8][8])
except:
 pass
try:
 g[5][8]=m(g[5][8],g[5][8]+g[8][8])
except:
 pass
try:
 g[6][8]=m(g[6][8],g[6][8]+g[8][8])
except:
 pass
try:
 g[7][8]=m(g[7][8],g[7][8]+g[8][8])
except:
 pass
try:
 g[8][8]=m(g[8][8],g[8][8]+g[8][8])
except:
 pass
try:
 g[9][8]=m(g[9][8],g[9][8]+g[8][8])
except:
 pass
try:
 g[0][9]=m(g[0][9],g[0][8]+g[8][9])
except:
 pass
try:
 g[1][9]=m(g[1][9],g[1][8]+g[8][9])
except:
 pass
try:
 g[2][9]=m(g[2][9],g[2][8]+g[8][9])
except:
 pass
try:
 g[3][9]=m(g[3][9],g[3][8]+g[8][9])
except:
 pass
try:
 g[4][9]=m(g[4][9],g[4][8]+g[8][9])
except:
 pass
try:
 g[5][9]=m(g[5][9],g[5][8]+g[8][9])
except:
 pass
try:
 g[6][9]=m(g[6][9],g[6][8]+g[8][9])
except:
 pass
try:
 g[7][9]=m(g[7][9],g[7][8]+g[8][9])
except:
 pass
try:
 g[8][9]=m(g[8][9],g[8][8]+g[8][9])
except:
 pass
try:
 g[9][9]=m(g[9][9],g[9][8]+g[8][9])
except:
 pass
try:
 g[0][0]=m(g[0][0],g[0][9]+g[9][0])
except:
 pass
try:
 g[1][0]=m(g[1][0],g[1][9]+g[9][0])
except:
 pass
try:
 g[2][0]=m(g[2][0],g[2][9]+g[9][0])
except:
 pass
try:
 g[3][0]=m(g[3][0],g[3][9]+g[9][0])
except:
 pass
try:
 g[4][0]=m(g[4][0],g[4][9]+g[9][0])
except:
 pass
try:
 g[5][0]=m(g[5][0],g[5][9]+g[9][0])
except:
 pass
try:
 g[6][0]=m(g[6][0],g[6][9]+g[9][0])
except:
 pass
try:
 g[7][0]=m(g[7][0],g[7][9]+g[9][0])
except:
 pass
try:
 g[8][0]=m(g[8][0],g[8][9]+g[9][0])
except:
 pass
try:
 g[9][0]=m(g[9][0],g[9][9]+g[9][0])
except:
 pass
try:
 g[0][1]=m(g[0][1],g[0][9]+g[9][1])
except:
 pass
try:
 g[1][1]=m(g[1][1],g[1][9]+g[9][1])
except:
 pass
try:
 g[2][1]=m(g[2][1],g[2][9]+g[9][1])
except:
 pass
try:
 g[3][1]=m(g[3][1],g[3][9]+g[9][1])
except:
 pass
try:
 g[4][1]=m(g[4][1],g[4][9]+g[9][1])
except:
 pass
try:
 g[5][1]=m(g[5][1],g[5][9]+g[9][1])
except:
 pass
try:
 g[6][1]=m(g[6][1],g[6][9]+g[9][1])
except:
 pass
try:
 g[7][1]=m(g[7][1],g[7][9]+g[9][1])
except:
 pass
try:
 g[8][1]=m(g[8][1],g[8][9]+g[9][1])
except:
 pass
try:
 g[9][1]=m(g[9][1],g[9][9]+g[9][1])
except:
 pass
try:
 g[0][2]=m(g[0][2],g[0][9]+g[9][2])
except:
 pass
try:
 g[1][2]=m(g[1][2],g[1][9]+g[9][2])
except:
 pass
try:
 g[2][2]=m(g[2][2],g[2][9]+g[9][2])
except:
 pass
try:
 g[3][2]=m(g[3][2],g[3][9]+g[9][2])
except:
 pass
try:
 g[4][2]=m(g[4][2],g[4][9]+g[9][2])
except:
 pass
try:
 g[5][2]=m(g[5][2],g[5][9]+g[9][2])
except:
 pass
try:
 g[6][2]=m(g[6][2],g[6][9]+g[9][2])
except:
 pass
try:
 g[7][2]=m(g[7][2],g[7][9]+g[9][2])
except:
 pass
try:
 g[8][2]=m(g[8][2],g[8][9]+g[9][2])
except:
 pass
try:
 g[9][2]=m(g[9][2],g[9][9]+g[9][2])
except:
 pass
try:
 g[0][3]=m(g[0][3],g[0][9]+g[9][3])
except:
 pass
try:
 g[1][3]=m(g[1][3],g[1][9]+g[9][3])
except:
 pass
try:
 g[2][3]=m(g[2][3],g[2][9]+g[9][3])
except:
 pass
try:
 g[3][3]=m(g[3][3],g[3][9]+g[9][3])
except:
 pass
try:
 g[4][3]=m(g[4][3],g[4][9]+g[9][3])
except:
 pass
try:
 g[5][3]=m(g[5][3],g[5][9]+g[9][3])
except:
 pass
try:
 g[6][3]=m(g[6][3],g[6][9]+g[9][3])
except:
 pass
try:
 g[7][3]=m(g[7][3],g[7][9]+g[9][3])
except:
 pass
try:
 g[8][3]=m(g[8][3],g[8][9]+g[9][3])
except:
 pass
try:
 g[9][3]=m(g[9][3],g[9][9]+g[9][3])
except:
 pass
try:
 g[0][4]=m(g[0][4],g[0][9]+g[9][4])
except:
 pass
try:
 g[1][4]=m(g[1][4],g[1][9]+g[9][4])
except:
 pass
try:
 g[2][4]=m(g[2][4],g[2][9]+g[9][4])
except:
 pass
try:
 g[3][4]=m(g[3][4],g[3][9]+g[9][4])
except:
 pass
try:
 g[4][4]=m(g[4][4],g[4][9]+g[9][4])
except:
 pass
try:
 g[5][4]=m(g[5][4],g[5][9]+g[9][4])
except:
 pass
try:
 g[6][4]=m(g[6][4],g[6][9]+g[9][4])
except:
 pass
try:
 g[7][4]=m(g[7][4],g[7][9]+g[9][4])
except:
 pass
try:
 g[8][4]=m(g[8][4],g[8][9]+g[9][4])
except:
 pass
try:
 g[9][4]=m(g[9][4],g[9][9]+g[9][4])
except:
 pass
try:
 g[0][5]=m(g[0][5],g[0][9]+g[9][5])
except:
 pass
try:
 g[1][5]=m(g[1][5],g[1][9]+g[9][5])
except:
 pass
try:
 g[2][5]=m(g[2][5],g[2][9]+g[9][5])
except:
 pass
try:
 g[3][5]=m(g[3][5],g[3][9]+g[9][5])
except:
 pass
try:
 g[4][5]=m(g[4][5],g[4][9]+g[9][5])
except:
 pass
try:
 g[5][5]=m(g[5][5],g[5][9]+g[9][5])
except:
 pass
try:
 g[6][5]=m(g[6][5],g[6][9]+g[9][5])
except:
 pass
try:
 g[7][5]=m(g[7][5],g[7][9]+g[9][5])
except:
 pass
try:
 g[8][5]=m(g[8][5],g[8][9]+g[9][5])
except:
 pass
try:
 g[9][5]=m(g[9][5],g[9][9]+g[9][5])
except:
 pass
try:
 g[0][6]=m(g[0][6],g[0][9]+g[9][6])
except:
 pass
try:
 g[1][6]=m(g[1][6],g[1][9]+g[9][6])
except:
 pass
try:
 g[2][6]=m(g[2][6],g[2][9]+g[9][6])
except:
 pass
try:
 g[3][6]=m(g[3][6],g[3][9]+g[9][6])
except:
 pass
try:
 g[4][6]=m(g[4][6],g[4][9]+g[9][6])
except:
 pass
try:
 g[5][6]=m(g[5][6],g[5][9]+g[9][6])
except:
 pass
try:
 g[6][6]=m(g[6][6],g[6][9]+g[9][6])
except:
 pass
try:
 g[7][6]=m(g[7][6],g[7][9]+g[9][6])
except:
 pass
try:
 g[8][6]=m(g[8][6],g[8][9]+g[9][6])
except:
 pass
try:
 g[9][6]=m(g[9][6],g[9][9]+g[9][6])
except:
 pass
try:
 g[0][7]=m(g[0][7],g[0][9]+g[9][7])
except:
 pass
try:
 g[1][7]=m(g[1][7],g[1][9]+g[9][7])
except:
 pass
try:
 g[2][7]=m(g[2][7],g[2][9]+g[9][7])
except:
 pass
try:
 g[3][7]=m(g[3][7],g[3][9]+g[9][7])
except:
 pass
try:
 g[4][7]=m(g[4][7],g[4][9]+g[9][7])
except:
 pass
try:
 g[5][7]=m(g[5][7],g[5][9]+g[9][7])
except:
 pass
try:
 g[6][7]=m(g[6][7],g[6][9]+g[9][7])
except:
 pass
try:
 g[7][7]=m(g[7][7],g[7][9]+g[9][7])
except:
 pass
try:
 g[8][7]=m(g[8][7],g[8][9]+g[9][7])
except:
 pass
try:
 g[9][7]=m(g[9][7],g[9][9]+g[9][7])
except:
 pass
try:
 g[0][8]=m(g[0][8],g[0][9]+g[9][8])
except:
 pass
try:
 g[1][8]=m(g[1][8],g[1][9]+g[9][8])
except:
 pass
try:
 g[2][8]=m(g[2][8],g[2][9]+g[9][8])
except:
 pass
try:
 g[3][8]=m(g[3][8],g[3][9]+g[9][8])
except:
 pass
try:
 g[4][8]=m(g[4][8],g[4][9]+g[9][8])
except:
 pass
try:
 g[5][8]=m(g[5][8],g[5][9]+g[9][8])
except:
 pass
try:
 g[6][8]=m(g[6][8],g[6][9]+g[9][8])
except:
 pass
try:
 g[7][8]=m(g[7][8],g[7][9]+g[9][8])
except:
 pass
try:
 g[8][8]=m(g[8][8],g[8][9]+g[9][8])
except:
 pass
try:
 g[9][8]=m(g[9][8],g[9][9]+g[9][8])
except:
 pass
try:
 g[0][9]=m(g[0][9],g[0][9]+g[9][9])
except:
 pass
try:
 g[1][9]=m(g[1][9],g[1][9]+g[9][9])
except:
 pass
try:
 g[2][9]=m(g[2][9],g[2][9]+g[9][9])
except:
 pass
try:
 g[3][9]=m(g[3][9],g[3][9]+g[9][9])
except:
 pass
try:
 g[4][9]=m(g[4][9],g[4][9]+g[9][9])
except:
 pass
try:
 g[5][9]=m(g[5][9],g[5][9]+g[9][9])
except:
 pass
try:
 g[6][9]=m(g[6][9],g[6][9]+g[9][9])
except:
 pass
try:
 g[7][9]=m(g[7][9],g[7][9]+g[9][9])
except:
 pass
try:
 g[8][9]=m(g[8][9],g[8][9]+g[9][9])
except:
 pass
try:
 g[9][9]=m(g[9][9],g[9][9]+g[9][9])
except:
 pass
print(max(list(map(max, g))))


from functools import reduce
from itertools import chain

n = int(input())
print((max(list(map(
    max,
    reduce(
        lambda a, k: reduce(
            lambda a, i: reduce(
                lambda a, j: list(chain(
                    a[:i],
                    [list(chain(
                        a[i][:j],
                        [min(a[i][j], a[i][k] + a[k][j])],
                        a[i][j+1:],
                    ))],
                    a[i+1:],
                )),
                list(range(n)),
                a,
            ),
            list(range(n)),
            a,
        ),
        list(range(n)),
        list([list(map(int, input().split())) for i in range(n)])))))))


import sys, itertools, collections
n = int(input())
d = list([list(map(int, s.split())) for s in sys.stdin.readlines()])
def assign(t):
    k,i,j = t
    d[i][j] = min(d[i][j], d[i][k] + d[k][j])
collections.deque(maxlen=0).extend(list(map(assign, itertools.product(list(range(n)), **{'taeper'[::-1]:3}))))
print(max(list(map(max, d))))


from itertools import product

def relax( D, f ):
  k, i, j = f
  D[ i ][ j ] = min( D[ i ][ j ], D[ i ][ k ] + D[ k ][ j ] )

N = int( input() )
D = list( [list( map( int, input().split() ) ) for i in range( N )] )
list( [relax( D, i ) for i in product( list(range( N)), list(range( N)), list(range( N)) )] )
print( max( list(map( max, D )) ) )