var
N, M, i, j, abuse: integer;
matrix: array [1..100, 1..100] of integer;
min, max: int64;
function max_in_column(j, N: integer): integer;
var
i: integer;
begin
for i := 1 to N do
begin
if matrix[i, j] >= max then
max := matrix[i, j];
end;
max_in_column := max;
end;
function min_in_string(i, M: integer): integer;
var
j: integer;
begin
for j := 1 to M do
if matrix[i, j] <= min then
min := matrix[i, j];
min_in_string := min;
end;
procedure sedlov_dot(j, i, N, M: integer);
begin
min := 92233720;
if matrix[i, j] = min_in_string(i, M) then
begin
Writeln(i, ' ', j);
abuse := 1;
end;
end;
begin
Read(N, M);
for i := 1 to N do
for j := 1 to M do
Read(matrix[i, j]);
abuse := 0;
for j := 1 to M do
begin
max := -92233720;
for i := 1 to N do
if matrix[i, j] = max_in_column(j, M) then
sedlov_dot(j, i, N, M);
end;
if abuse = 0 then
Write(abuse);
end.