#include<iostream>
#include<string>
using namespace std;
int main(){
string ident;
int temp=0,sum=0;
while(cin >> ident){
int calculator=8,result=0,sum=0;
if(ident.size() != 10){
break;
}
if(ident[0] < 65 || ident[0] > 90){
break;
}
for(int i = 1 ; i < 9 ; i++){
if(ident[i] < 48 || ident[i] > 57)
break;
}
if(ident[0] <= 'H'){
temp = ident[0] - 55;
}
if(ident[0] == 'I'){
temp = 34;
}
if(ident[0] > 'I' && ident[0] < 'O'){
temp = ident[0] - 56;
}
if(ident[0] == 'O'){
temp = 35;
}
if(ident[0] > 'O' && ident[0] < 'W'){
temp = ident[0] - 57;
}
if(ident[0] == 'W'){
temp = 32;
}if(ident[0] > 'W' && ident[0] <= 'Z'){
temp = ident[0] - 58;
}
int Ar[9]={0};
for(int i = 0 ; i < 9 ; i++){
Ar[i] = ident[i+1]-48;
}
result = (temp/10) + ((temp%10)*9) + Ar[8];
for(int i = 0 ; i < 8 ; i++){
if(calculator > 0){
sum = sum+(Ar[i]*calculator);
calculator--;
}
}
result = result+sum;
if(result%10 == 0)
cout << "real" << endl;
else
cout << "fake" << endl;
}
return 0;
}