#include <cstdio>
using namespace std;
int main(void)
{
freopen("sie.in","r",stdin);
freopen("sie.out","w",stdout);
int i,j,k,n,map[201][201];
bool able;
scanf("%d",&n);
for (i=1;i<=n;i++)
for (j=1;j<=n;j++)
scanf("%d",&map[i][j]);
for (i=1;i<=n-1;i++)
for (j=i+1;j<=n;j++)
{
able=true;
for (k=1;k<=n;k++)
if (k!=i&&k!=j&&map[i][j]==map[i][k]+map[j][k])
{
able=false;
break;
}
if (able)
printf("%d %d\n",i,j);
}
fclose(stdin);
fclose(stdout);
return(0);
}