Program BTT;
Uses crt;
Var n,i: longint;
Function ngto(a: longint): boolean;
Var i: longint;
Begin
If a<2 then exit(false);
i:=2;
While i<= n div 2 do
Begin
If a mod 2 = 0 then exit(false);
inc(i);
End;
Exit(true);
End;
Function cp(a: longint): boolean;
Begin
If a=sqr(trunc(sqrt(a))) then exit(true);
Exit(false);
End;
Begin
Clrscr;
Write('Nhap n: '); Readln(n);
If ngto(n) then Writeln(n,' la so nguyen to')
Else Writeln(n,' khong phai so nguyen to');
i:=0;
Write('Cac so chinh phuong tu 0 - ',n,': ');
While i<=n do
Begin
If cp(i) then Write(i,' ');
inc(i);
End;
Writeln;
i:=2;
Write('Cac so nguyen to tu 2 - ',n,': ');
While i<=n do
Begin
If ngto(i) then Write(i,' ');
inc(i);
End;
Readln
End.