#include <iostream>
using namespace std;
int trains(int x)
{
int temp = x;
int sum = 0;
while (temp>0)
{
sum *= 10;
int now = temp % 10;
sum += now;
temp /= 10;
}
return sum;
}
int isprime(int z)
{
int count = 0;
for (int i = 1; i <= z; i++)
{
if (z % i == 0)
{
count++;
}
}
if (count == 2)//質數
return 2;
else
return 3;
}
int main() {
int n;
while (cin >> n)
{
int a = isprime(n);
int n1 = trains(n);//倒轉的數
int b = isprime(n1);
if (a == 2 && b == 2 && n!=n1)
{
cout << n << " is emirp." << endl;
}
else if (a == 2)
{
cout << n << " is prime." << endl;
}
else
{
cout << n << " is not prime." << endl;
}
}
return 0;
}