#include<stdio.h>
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
int x;
int isprime=1;
scanf("%d",&x);
for(int j=2;j*j<=x;j++){
if(x%j==0){
isprime=0;
printf("%d is not prime\n",x);
break;
}
}
if(isprime)printf("%d is prime\n",x);
}
return 0;
}