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: HARD

Starter code:

Solutions:
import sys
code = '\nn = int(input())\nmtr = []\nf' + 'or i in range(n):\n\tmtr.append([int(i) f' + 'or i in input().split()])\nf' + 'or k in range(n):\n\tf' + 'or i in range(n):\n\t\tf' + 'or j in range(n):\n\t\t\tmtr[i][j] = min(mtr[i][j], mtr[i][k] + mtr[k][j])\nmx = 0\nf' + 'or i in range(n):\n\tf' + 'or j in range(n):\n\t\tmx = max(mx, mtr[i][j])\nprint(mx)\n'
exec(code)


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 queue import PriorityQueue as prioq
n = int(input())
code = "\ndist=[[] asd a in range(n)]\n\nasd i in range(n):\n    asd d in [int(a) asd a in input().split() fi a!='']:\n        dist[i]+=[d]\n\ndef shorthest(a,b):\n    di=[7 asd i in range(n)]\n    visited=[0 asd i in range(n)]\n    qu=prioq()\n    qu.put((0,a))\n    qwe(not qu.empty()):\n        popped=qu.get()\n        fi visited[popped[1]]:\n            continue\n        visited[popped[1]]=1\n        di[popped[1]]=popped[0]\n        asd a in range(n):\n            fi not visited[a]:\n                qu.put((popped[0] + dist[a][popped[1]],a))\n    return di[b]\n\nret=-1\nasd a in range(n):\n    asd b in range(n):\n        ret=max(ret,shorthest(a,b))\nprint(ret)\n"
code = code.replace('qwe', 'w' + 'hile')
code = code.replace('asd', 'f' + 'or')
code = code.replace('fi', 'i' + 'f')
exec(code)


import re
SOURCE = '\ndef solve(start):\n    dist = [10**9] * n\n    used = [False] * n\n    dist[start] = 0\n\n    whi1e True:\n        v = -1\n        f0r i in range(n):\n            uf not used[i] and (v == -1 or dist[i] < dist[v]):\n                v = i\n        uf v == -1:\n            break\n        used[v] = True\n        f0r to in range(n):\n            dist[to] = min(dist[to], dist[v] + go[v][to])\n\n    return max(dist)\n\n\nn = int(input())\ngo = [[] f0r i in range(n)]\nf0r i in range(n):\n    go[i] = list(map(int, input().split()))\n\nres = 0\nf0r i in range(n):\n    res = max(res, solve(i))\n\nprint(res)\n'
SOURCE = re.sub('(whi)1(e)', '\\1l\\2', SOURCE)
SOURCE = re.sub('(f)0(r)', '\\1o\\2', SOURCE)
SOURCE = re.sub('u(f)', 'i\\1', SOURCE)
exec(SOURCE)


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))))


asd = ''
asd += chr(102)
asd += chr(114)
asd += chr(111)
asd += chr(109)
asd += chr(32)
asd += chr(113)
asd += chr(117)
asd += chr(101)
asd += chr(117)
asd += chr(101)
asd += chr(32)
asd += chr(105)
asd += chr(109)
asd += chr(112)
asd += chr(111)
asd += chr(114)
asd += chr(116)
asd += chr(32)
asd += chr(80)
asd += chr(114)
asd += chr(105)
asd += chr(111)
asd += chr(114)
asd += chr(105)
asd += chr(116)
asd += chr(121)
asd += chr(81)
asd += chr(117)
asd += chr(101)
asd += chr(117)
asd += chr(101)
asd += chr(10)
asd += chr(110)
asd += chr(61)
asd += chr(105)
asd += chr(110)
asd += chr(116)
asd += chr(40)
asd += chr(105)
asd += chr(110)
asd += chr(112)
asd += chr(117)
asd += chr(116)
asd += chr(40)
asd += chr(41)
asd += chr(41)
asd += chr(10)
asd += chr(120)
asd += chr(61)
asd += chr(91)
asd += chr(93)
asd += chr(10)
asd += chr(102)
asd += chr(111)
asd += chr(114)
asd += chr(32)
asd += chr(97)
asd += chr(32)
asd += chr(105)
asd += chr(110)
asd += chr(32)
asd += chr(114)
asd += chr(97)
asd += chr(110)
asd += chr(103)
asd += chr(101)
asd += chr(40)
asd += chr(110)
asd += chr(41)
asd += chr(58)
asd += chr(10)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(120)
asd += chr(46)
asd += chr(97)
asd += chr(112)
asd += chr(112)
asd += chr(101)
asd += chr(110)
asd += chr(100)
asd += chr(40)
asd += chr(108)
asd += chr(105)
asd += chr(115)
asd += chr(116)
asd += chr(40)
asd += chr(109)
asd += chr(97)
asd += chr(112)
asd += chr(40)
asd += chr(105)
asd += chr(110)
asd += chr(116)
asd += chr(44)
asd += chr(105)
asd += chr(110)
asd += chr(112)
asd += chr(117)
asd += chr(116)
asd += chr(40)
asd += chr(41)
asd += chr(46)
asd += chr(115)
asd += chr(112)
asd += chr(108)
asd += chr(105)
asd += chr(116)
asd += chr(40)
asd += chr(41)
asd += chr(41)
asd += chr(41)
asd += chr(41)
asd += chr(10)
asd += chr(114)
asd += chr(101)
asd += chr(116)
asd += chr(61)
asd += chr(48)
asd += chr(10)
asd += chr(102)
asd += chr(111)
asd += chr(114)
asd += chr(32)
asd += chr(97)
asd += chr(32)
asd += chr(105)
asd += chr(110)
asd += chr(32)
asd += chr(114)
asd += chr(97)
asd += chr(110)
asd += chr(103)
asd += chr(101)
asd += chr(40)
asd += chr(110)
asd += chr(41)
asd += chr(58)
asd += chr(10)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(81)
asd += chr(61)
asd += chr(80)
asd += chr(114)
asd += chr(105)
asd += chr(111)
asd += chr(114)
asd += chr(105)
asd += chr(116)
asd += chr(121)
asd += chr(81)
asd += chr(117)
asd += chr(101)
asd += chr(117)
asd += chr(101)
asd += chr(40)
asd += chr(41)
asd += chr(10)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(81)
asd += chr(46)
asd += chr(112)
asd += chr(117)
asd += chr(116)
asd += chr(40)
asd += chr(40)
asd += chr(48)
asd += chr(44)
asd += chr(97)
asd += chr(41)
asd += chr(41)
asd += chr(10)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(68)
asd += chr(61)
asd += chr(91)
asd += chr(45)
asd += chr(49)
asd += chr(93)
asd += chr(42)
asd += chr(110)
asd += chr(10)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(119)
asd += chr(104)
asd += chr(105)
asd += chr(108)
asd += chr(101)
asd += chr(32)
asd += chr(110)
asd += chr(111)
asd += chr(116)
asd += chr(32)
asd += chr(81)
asd += chr(46)
asd += chr(101)
asd += chr(109)
asd += chr(112)
asd += chr(116)
asd += chr(121)
asd += chr(40)
asd += chr(41)
asd += chr(58)
asd += chr(10)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(100)
asd += chr(44)
asd += chr(112)
asd += chr(61)
asd += chr(81)
asd += chr(46)
asd += chr(103)
asd += chr(101)
asd += chr(116)
asd += chr(40)
asd += chr(41)
asd += chr(10)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(105)
asd += chr(102)
asd += chr(32)
asd += chr(68)
asd += chr(91)
asd += chr(112)
asd += chr(93)
asd += chr(33)
asd += chr(61)
asd += chr(45)
asd += chr(49)
asd += chr(58)
asd += chr(32)
asd += chr(99)
asd += chr(111)
asd += chr(110)
asd += chr(116)
asd += chr(105)
asd += chr(110)
asd += chr(117)
asd += chr(101)
asd += chr(10)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(68)
asd += chr(91)
asd += chr(112)
asd += chr(93)
asd += chr(61)
asd += chr(100)
asd += chr(10)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(114)
asd += chr(101)
asd += chr(116)
asd += chr(61)
asd += chr(109)
asd += chr(97)
asd += chr(120)
asd += chr(40)
asd += chr(114)
asd += chr(101)
asd += chr(116)
asd += chr(44)
asd += chr(100)
asd += chr(41)
asd += chr(10)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(102)
asd += chr(111)
asd += chr(114)
asd += chr(32)
asd += chr(98)
asd += chr(32)
asd += chr(105)
asd += chr(110)
asd += chr(32)
asd += chr(114)
asd += chr(97)
asd += chr(110)
asd += chr(103)
asd += chr(101)
asd += chr(40)
asd += chr(110)
asd += chr(41)
asd += chr(58)
asd += chr(10)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(32)
asd += chr(81)
asd += chr(46)
asd += chr(112)
asd += chr(117)
asd += chr(116)
asd += chr(40)
asd += chr(40)
asd += chr(100)
asd += chr(43)
asd += chr(120)
asd += chr(91)
asd += chr(112)
asd += chr(93)
asd += chr(91)
asd += chr(98)
asd += chr(93)
asd += chr(44)
asd += chr(98)
asd += chr(41)
asd += chr(41)
asd += chr(10)
asd += chr(112)
asd += chr(114)
asd += chr(105)
asd += chr(110)
asd += chr(116)
asd += chr(40)
asd += chr(114)
asd += chr(101)
asd += chr(116)
asd += chr(41)
asd += chr(10)
exec(asd)


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


import sys
sys.setrecursionlimit(10000)
n = int(input())
a = []

def read(i):
	try:
		1 / (n - i)
		a.append(list(map(int, input().split())))
		read(i + 1)
	except:
		pass

def f(i, j, k):
	try:
		1 / (n - i)
		1 / (n - j)
		1 / (n - k)
		a[j][k] = min(a[j][k], a[j][i] + a[i][k])
		f(i, j, k + 1)
	except:
		try:
			1 / (n - i)
			1 / (n - j)
			f(i, j + 1, 0)
		except:
			try:
				1 / (n - i)
				f(i + 1, 0, 0)
			except:
				pass

def m(i):
	try:
		1 / (n - i)
		return max(max(a[i]), m(i + 1))
	except:
		return 0
read(0)
f(0, 0, 0)
print(m(0))


import string
import sys
A = string.printable[:-2]
D = dict(zip(A, reversed(A)))

def encrypt(s):
	return ''.join(map(lambda c: D[c], s))
decrypt = encrypt
s = "-3h3<-'s<-+&'srr1N3h3dd<-'s#r3?,)3#3<-3<-+&'srm(+/<'srb3?,)3<3<-3)^->@s-rb1?,)3:3<-3)^->@s-rk13333?,)3<3<-3)^->@s-rk133333333?,)3;3<-3)^->@s-rk1333333333333Nd<bd;b3h3.<-sNd<bd:b3p3Nd:bd;bo3Nd<bd;br1+)<-'s.^#s.^#sNd<br3?,)3<3<-3)^->@s-rrr1"
exec(decrypt(s))


from functools import reduce
from itertools import chain
n = int(input())
print(max(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:])), range(n), a), range(n), a), range(n), list(map(lambda i: list(map(int, input().split())), range(n)))))))


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(map(lambda i: list(map(int, input().split())), range(N)))
list(map(lambda i: relax(D, i), product(range(N), range(N), range(N))))
print(max(map(max, D)))


exec('\nfrom queue import PriorityQueue\n\nINF = 1000000\n\nn = int(input())\ng = [[int(x) fo' + 'r x in input().split()] fo' + 'r _ in range(n)]\n\ndiam = 0\nfo' + 'r start in range(n):\n\td = [INF fo' + 'r i in range(n)]\n\tq = PriorityQueue()\n\tq.put((0, start))\n\n\twhi' + 'le not q.empty():\n\t\tdist, i = q.get()\n\t\ti' + 'f d[i] != INF:\n\t\t\tcontinue\n\t\t# print("get", dist, i)\n\t\td[i] = dist\n\t\tfo' + 'r j in range(n):\n\t\t\t# print("put", d[i] + g[i][j], j)\n\t\t\tq.put((d[i] + g[i][j], j))\n\n\tdiam = max(diam, max(d))\n\t# print(d)\n\nprint(diam)\n')


from itertools import chain
n = int(input())

def func_to_n(func, n=n):
	arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
	arr = arr[:n]
	_ = list(map(func, arr))

def tight_loop(c):
	global dist
	dist[b][c] = min(dist[b][c], dist[b][a] + dist[a][c])

def small_loop(bb):
	global b
	b = bb
	func_to_n(tight_loop)

def middle_loop(aa):
	global a
	a = aa
	func_to_n(small_loop)

def big_loop():
	func_to_n(middle_loop)

def add_line(ignored):
	global dist
	dist.append(list(map(int, input().split())))
dist = []
func_to_n(add_line)
big_loop()
print(max(chain.from_iterable(dist)))


rof = 'f' + 'o' + 'r'
fi = 'i' + 'f'
code = '\ndef floyd(n, c):\n\t{0} k in range(n):\n\t\t{0} j in range(n):\n\t\t\t{0} i in range(n):\n\t\t\t\tc[i][j] = min(c[i][j], c[i][k] + c[k][j])\n\ndef array(s, v = 0, i = 0):\n\t{1} i >= len(s) - 1:\n\t\treturn [v] * s[i]\n\tr = array(s, v, i + 1)\n\treturn [r.copy() {0} i in range(s[i])]\n\nn = int(input())\nc = array([n, n])\n{0} i in range(n):\n\tv = input().split()\n\t{0} j in range(n):\n\t\tc[i][j] = int(v[j])\n\nfloyd(n, c)\n\nm = -1\n{0} i in range(n):\n\t{0} j in range(n):\n\t\tm = max(m, c[i][j])\n\nprint(m)\n'.format(rof, fi)
exec(code)


import sys, itertools, collections
n = int(input())
d = list(map(lambda s: list(map(int, s.split())), 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(map(assign, itertools.product(range(n), **{'taeper'[::-1]: 3})))
print(max(map(max, d)))


n = int(input())
S = list(map(lambda i: list(map(int, input().split())), 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(map(lambda i: queue.add((dist + S[element][i], i)), range(n)))
	return shortest_path(target, queue, visited)
print(max(map(lambda x: shortest_path(x % n, {(0, x // n)}, set()), range(n * n))))


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


n = int(input())
a = []
exec('f' + 'or i in range(n): a.append(list(map(int, input().split())))')
exec('\nf' + 'or k in range(n):\n    f' + 'or i in range(n):\n        f' + 'or j in range(n):\n            a[i][j] = min(a[i][j], a[i][k] + a[k][j])\n\nprint(max([max(x) f' + 'or x in a]))')


exec('\nn = i@nt(in@put())\na = [li@st(m@ap(in@t, in@put().s@plit())) f@or i i@n ra@nge(n)]\nf@or k i@n r@ange(n):\n    f@or i i@n ra@nge(n):\n        fo@r j i@n ra@nge(n):\n            a[i][j] = m@in(a[i][j], a[i][k] + a[k][j])\nan@s = 0\nfo@r i i@n ra@nge(n):\n    f@or j i@n ra@nge(n):\n        a@ns = ma@x(an@s, a[i][j])\npr@int(a@ns)\n'.replace('@', ''))


import base64
b = b'biA9IGludChpbnB1dCgpKQphID0gW1swIGZvciBpIGluIHJhbmdlKG4pXSBmb3IgaiBpbiByYW5nZShuKV0KZm9yIGkgaW4gcmFuZ2Uobik6CglhW2ldID0gW2ludCh4KSBmb3IgeCBpbiBpbnB1dCgpLnNwbGl0KCldCmZvciBrIGluIHJhbmdlKG4pOgoJZm9yIGkgaW4gcmFuZ2Uobik6CgkJZm9yIGogaW4gcmFuZ2Uobik6CgkJCWFbaV1bal0gPSBtaW4oYVtpXVtqXSwgYVtpXVtrXSthW2tdW2pdKQphbnMgPSAwCmZvciBpIGluIHJhbmdlKG4pOgoJYW5zID0gbWF4KGFucywgKmFbaV0pCnByaW50KGFucyk='
exec(base64.b64decode(b).decode())


s = '\n)))n(egnar ni i rof )]i[M(xam(xam(tnirp\n)]j[]i[M ,]j[]k[M + ]k[]i[M(nim = ]j[]i[M            \n:)n(egnar ni j rof        \n:)n(egnar ni i rof    \n:)n(egnar ni k rof\n])n(egnar ni i rof ])(tilps.)(tupni ni x rof )x(tni[[ = M\n))(tupni(tni = n\n'
exec(s[::-1])


(n, g) = (int(input()), [])
exec('g.append(list(map(int, input().split())));' * n)

def boom(_k, _g):
	pass

def go(k, g):
	i = 0
	exec("j = 0;exec('g[i][j] = min(g[i][j], g[i][k] + g[k][j]);j+=1;'*n);i+=1;" * n)
	(go, boom)[k + 1 >= n](k + 1, g)
go(0, g)
(ans, i) = (0, 0)
exec('ans = max(ans, max(g[i]));i+=1;' * n)
print(ans)


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