program ex;
type
ss=array[1..200,1..200]of integer;
sz=array[1..200,1..200]of boolean;
var
map:ss;
g:sz;
n:integer;
i,j,k:integer;
flag:integer;
begin
assign(input,'sie.in');
assign(output,'sie.out');
reset(input);
rewrite(output);
readln(n);
for i:=1 to n do
for j:=1 to n do
read(map[i,j]);
close(input);
for i:=1 to n-1 do
for j:=i+1 to n do
begin
flag:=0;
for k:=1 to n do
if flag<1 then
if (i<>k)and(i<>j)and(j<>k) then
if map[i,j]=map[i,k]+map[k,j] then inc(flag);
if flag<>0 then
begin
g[i,j]:=true;
g[j,i]:=true;
end;
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if not g[i,j] then
writeln(i,' ',j);
close(output);
end.