#include<iostream>
using namespace std;
int main()
{
int a;
cin>>a;
for(int j=1;j<=a;j++)
{
int b,m=0;
cin>>b;
for(int i=2;i*i<=b;i++)
{
if(b%i==0)
{
m=1;
break;
}
}
if(m==0)
cout<<b<<" is prime"<<endl;
else
cout<<b<<" is not prime"<<endl;
}
return 0;
}