program skaiciu_kriptograma;
  { 117 u‘davinys }
  procedure kriptograma (var f: text);
    var dauginamasis, daugiklis, sandauga: longint;
        a, b, c: 1..9;    { skaitmenys }
  begin
    for dauginamasis := 1000 to 9999 do
      for a := 1 to 9 do
        for b := 1 to 9 do
          for c := 1 to 9 do
            begin
              daugiklis := a * 100 + b * 10 + c;
              sandauga := dauginamasis * daugiklis;
              if (dauginamasis * c <= 9999) and  { ma‘esnis u‘ 1000 }
                 (dauginamasis * b >= 10000) and { didesnis u‘ 99999 }
                 (dauginamasis * a >= 10000) and { didesnis u‘ 99999 }
                 (sandauga <= 9999999)           { ma‘esnis u‘ 1000000 }
              then writeln (f, dauginamasis, daugiklis: 10, sandauga: 10)
            end
  end;

  var f: text;
      c: char;
begin
  writeln ('Norint vykdyti ži… program… reikia 17 Kb. laisvos vietos diske');
  writeln ('Ar tŠsite programos vykdym…: T/N');
  readln (c);
  if c in ['n', 'N']
     then halt;
  assign (f, 'D:\KRIPT.REZ');
  rewrite (f);
  kriptograma (f);
  close (f)
end.