#include<bits/stdc++.h>
using namespace std;
int a;
bool v[1000005];
int main() {
//freopen("checkin.txt","r",stdin);
//freopen("checkout1.txt","w",stdout);
v[1] = 1;
v[0] = 0;
for(long long i = 2;i <= 1000000;i++) {
if(v[i]) {
continue;
}
for(long long j = i * i;j <= 1000000;j += i) {
v[j] = 1;
}
}
while(cin>>a) {
if(v[a]) {
printf("%d is not prime.\n",a);
}
else{
int b = a;
int c = 0;
while(b) {
c *= 10;
c += b % 10;
b /= 10;
}
if(!v[c] and a != c) {
printf("%d is emirp.\n",a);
}
else{
printf("%d is prime.\n",a);
}
}
}
}