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