Program FNG;
Uses crt;
Var A: array[1..1000] of longint;
n,i,d: longint;
St: String;
Function ngto(a: longint): boolean;
Var i: longint;
Begin
If a<2 then exit(false);
For i:=2 to a div 2 do
If a mod i = 0 then exit(false);
exit(true);
End;
Begin
Clrscr;
Write('Nhap n: '); Readln(n);
Begin
Randomize;
For i:=1 to n do
Begin
A[i]:=Random(65001);
If A[i]=19 then inc(d);
End;
End;
For i:=1 to n do Write(A[i],' ');
Writeln;
Writeln('Co ',d,' so 19');
For i:=1 to n do
If A[i] mod 19 = 0 then Write(A[i],' ');
Writeln;
For i:=1 to n do
Begin
Str(A[i],St);
If (St[length(St)-1] = '1') and (St[length(St)] = '9') then Write(A[i],' ');
End;
Writeln;
For i:=1 to n do
If ngto(A[i]) then Write(A[i],' ');
Readln
End.