{$APPTYPE CONSOLE}
uses SysUtils;
var
  f: TextFile;
  i, N: Integer;
begin
  RandSeed:=999;
  AssignFile(f, 'input.txt'); Rewrite(f);
  N := StrToInt(ParamStr(2));
  Writeln(f, N);
  for i := 1 to N do
    case ParamStr(1)[1] of
    'i': Writeln(f, i, ' ', i, ' ', Random(100));
    'I': Writeln(f, i * 100 + Random(1000), ' ', i * 100 + Random(100), ' ', Random(1000));
    'r': Writeln(f, Random(N) + 1, ' ', Random(N) + 1, ' ', Random(1000));
    'R': Writeln(f, Random(N * 1000) + 1, ' ', Random(N * 1000) + 1, ' ', Random(1000000));
    'q': Writeln(f, Random(100) + 1, ' ', Random(100) + 1, ' ', Random(1000000));
    end;
  CloseFile(f);
end.
