program sie;
var
map:array[0..201,0..201]of longint;
a,b,c,i,j,n,k:longint;
F:BOOLEAN;
begin
assign(input,'sie.in');
assign(output,'sie.out');
reset(input);
rewrite(output);
for i:=0 to 201 do begin
for j:=0 to 201 do map[i,j]:=-1;
end;
readln(n);
for i:=1 to n do begin
for j:=1 to n do begin
read(a);
map[i,j]:=a;
end;
readln;
end;
for i:=1 to n do begin
for j:=i+1 to n do begin
k:=1; f:=true;
while (f) and(k<=n)do begin
if (map[i,j]=map[i,k]+map[k,j])and(k<>i)and(k<>j) then f:=false
else inc(k);
end;
if (f) and (k=n+1) then writeln(i,' ',j);
end;
end;
close(input); close(output);
End.