uses SysUtils;

var
  n,m,k,i,j: Integer;
  
begin
  n := StrToInt(ParamStr(1));
  m := StrToInt(ParamStr(2));
  k:=m*n;
  writeln(n,' ',m,' ',k);
  for i:=1 to n do
    for j:=1 to m do
      writeln(i,' ',j);
end.
