/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
Scanner in
= new Scanner
(System.
in); int n;
n = in.nextInt();
int [][] a = new int[n][n];
for( int i=0 ; i<n ; i++ )
{
for( int j=0 ; j<n ; j++ )
{
a[i][j] = in.nextInt();
}
}
for( int k=0 ; k<n ; k++ )
{
for( int i=0 ; i<n ; i++ )
{
for( int j=0 ; j<n ; j++ )
{
if( i!=j )
{
a
[i
][j
] = Math.
min(a
[i
][j
], a
[i
][k
]+a
[k
][j
]); }
}
}
}
for( int i=0 ; i<n ; i++ )
{
for( int j=0 ; j<n ; j++ )
{
if(j+1 == n)
{
}
else {
}
}
}
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVNjYW5uZXIgaW4gPSBuZXcgU2Nhbm5lcihTeXN0ZW0uaW4pOwoJCWludCBuOwoJCW4gPSBpbi5uZXh0SW50KCk7CgkJaW50IFtdW10gYSA9IG5ldyBpbnRbbl1bbl07CgkJZm9yKCBpbnQgaT0wIDsgaTxuIDsgaSsrICkKICAgIAl7CiAgICAgICAgCWZvciggaW50IGo9MCA7IGo8biA7IGorKyApCiAgICAgICAgCXsKICAgICAgICAJICAgIGFbaV1bal0gPSBpbi5uZXh0SW50KCk7CiAgICAgICAJCX0KICAgIAl9CiAgICAKICAgIAlmb3IoIGludCBrPTAgOyBrPG4gOyBrKysgKQogICAgCXsKICAgICAgICAJZm9yKCBpbnQgaT0wIDsgaTxuIDsgaSsrICkKICAgICAgICAJewogICAgICAgIAkgICAgZm9yKCBpbnQgaj0wIDsgajxuIDsgaisrICkKICAgICAgICAJICAgIHsKICAgICAgICAJICAgIAlpZiggaSE9aiApCiAgICAgICAgICAgICAgICAJewogICAgICAgICAgICAgICAgCSAgICBhW2ldW2pdID0gTWF0aC5taW4oYVtpXVtqXSwgYVtpXVtrXSthW2tdW2pdKTsKICAgICAgICAgICAgICAJCX0KICAgICAgICAJCX0KICAgIAkJfQoJCX0KCQlmb3IoIGludCBpPTAgOyBpPG4gOyBpKysgKQogICAgCXsKICAgIAkgICAgZm9yKCBpbnQgaj0wIDsgajxuIDsgaisrICkKICAgIAkgICAgewogICAgCSAgICAJU3lzdGVtLm91dC5wcmludChhW2ldW2pdKTsKICAgIAkgICAgCWlmKGorMSA9PSBuKQogICAgCSAgICAJewogICAgCSAgICAJCVN5c3RlbS5vdXQucHJpbnQoIlxuIik7CiAgICAJICAgIAl9CiAgICAJICAgIAllbHNlIHsKICAgIAkgICAgCQlTeXN0ZW0ub3V0LnByaW50KCcgJyk7CiAgICAJICAgIAl9CiAgICAJICAgIH0KCQl9Cgl9Cn0=