PROGRAM Bai_tap;
USES CRT;
CONST fi='D:\Pascal\Bai_tap\BT.inp';
fo='D:\Pascal\Bai_tap\BT.out';
VAR A:array[0..1000,0..1000] of byte;
B:array[0..10000,1..2] of byte;
n,m,x,y:integer;
f:text;
Procedure Read_file;
Var i,j:integer;
Begin
Assign(f,fi); Reset(f);
Readln(f,n,m);
For i:=0 to n do A[i,0]:=1;
For j:=0 to m do A[0,j]:=1;
For i:=1 to n do
For j:=1 to m do
Read(f,A[i,j]);
Close(f);
B[0,1]:=0;
For i:=1 to n do
Begin
For j:=1 to m do Write(A[i,j],' ');
Writeln;
End;
Writeln;
End;
Procedure Print_result;
Var i,j:integer;
Begin
Writeln('Yes!');
For i:=1 to B[0,1] do
Write('[',B[i,1],',',B[i,2],'] ');
End;
Procedure Attempt(x,y:integer);
Var kt:boolean;
Begin
B[0,1]:=B[0,1]+1;
B[B[0,1],1]:=x;
B[B[0,1],2]:=y;
If (x=n) and (y=m) then
Print_result
Else
Begin
kt:=False;
If y<m then
Begin
If A[x,y+1]=0 then Attempt(x,y+1);
kt:=True;
End;
If x<n then
Begin
If A[x+1,y]=0 then Attempt(x+1,y);
kt:=True;
End;
If kt=False then
Begin
If y>1 then
If A[x,y-1]=0 then Attempt(x,y-1);
If x>1 then
If A[x-1,y]=0 then Attempt(x-1,y);
End;
B[0,1]:=B[0,1]-1;
End;
End;
BEGIN
Clrscr;
Read_file;
Attempt(1,1);
READLN;
END.