#include
int reverse(int n)
{ int m;
for(m=0; n; n/=10)
m=m*10+n%10;
return m;
}
int isprime(int n)
{ int i;
for(i=2; i*i<=n; i++)
if(n%i==0)return 0;
return n>1;
}
int main()
{ int n,m;
while(scanf("%d",&n)==1)
{ if(isprime(n))
{ m=reverse(n);
if(m!=n&&isprime(m))
printf("%d is emirp.\n",n);
else
printf("%d is prime.\n",n);
}
else
printf("%d is not prime.\n",n);
}
return 0;
}