Var
aa[1..1000, 1..1000] : array of integer;
i, j, m, n : integer;
r : boolean;
begin
{считываем массив}
readln(m, n);
for i := 1 to m do
for j := 1 to n do
read(aa[i, j]);
{ r равен true до первого элемента, равного 0}
r := true;
i := 0;
while i <= m and r = true do<br> begin
i := i + 1;
j := 0;
while j <= n and r = true do<br> begin
j := j + 1;
if aa[i, j] = 0 then
r := false;
end;
end;
writeln(i, ' ', j);
end.