{$APPTYPE CONSOLE}

uses SysUtils;
var
  f: TextFile;
  i, N, s: Integer;
begin
  RandSeed := 33;
  s := StrToInt(ParamStr(1)); 
  N := StrToInt(ParamStr(2)); 
  AssignFile(f, 'input.txt'); Rewrite(f);
  Writeln(f, s, ' ', s, ' ', N);
  for i := 1 to N do begin
    case ParamStr(3)[1] of
    'm': Writeln(f, Random(s), ' ', Random(s), ' ', 200, ' ',Random(8)+1);
    'r': Writeln(f, Random(s), ' ', Random(s), ' ', Random(200) + 1, ' ',Random(8)+1);
    end;
  end;
  CloseFile(f);
end.
