uses
  symbols;

var
  i, m, n, p: longint;

begin
  assign(output, paramstr(1));
  rewrite(output);

  m := longintval(paramstr(2));
  n := longintval(paramstr(3));
  if paramcount > 3 then
    p := longintval(paramstr(4))
  else
    p := m;

  writeln(m, ' ', n);
  randomize;
  for i := 1 to n do
  begin
    writeln(random(100) + 1, ' ', random(p) + 1, ' ', random(100) + 1);
  end;
end.