int input list map int input split for in range for in range for in ra

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
n = int(input())
w = [list(map(int, input().split())) for i in range(n)]
for k in range(n):
for i in range(n):
for j in range(n):
if w[i][j] > w[i][k] + w[k][j]:
w[i][j] = w[i][k] + w[k][j]
print(max([max(p) for p in w])