program sie;
var
map:array[1..200,1..200] of longint;
ans:array[1..200,1..200] of boolean;
i,j,k,m,n:longint;
begin
assign(input,'sie.in');reset(input);
assign(output,'sie.out');rewrite(output);
readln(n);
fillchar(ans,sizeof(ans),true);
for i:=1 to n do
begin
for j:=1 to n do
read(map[i,j]);
readln;
end;
for k:=1 to n do
for i:=1 to n do
for j:=i+1 to n do
if (i<>j)and(j<>k)and(i<>k) then
if map[i,k]+map[k,j]=map[i,j] then ans[i,j]:=false;
for i:=1 to n-1 do
for j:=i+1 to n do
if ans[i,j] then writeln(i,' ',j);
close(output);
end.