//a020: 身分證檢驗
#include<iostream>
#include<cstring>
using namespace std;
int main(){
string num;
while(cin>>num){
int num_a[11],tatol=0;
if(num.at(0)=='A'){
num_a[0]=1;
num_a[1]=0;
}
else if(num.at(0)=='B'){
num_a[0]=1;
num_a[1]=1;
}
else if(num.at(0)=='C'){
num_a[0]=1;
num_a[1]=2;
}
else if(num.at(0)=='D'){
num_a[0]=1;
num_a[1]=3;
}
else if(num.at(0)=='E'){
num_a[0]=1;
num_a[1]=4;
}
else if(num.at(0)=='F'){
num_a[0]=1;
num_a[1]=5;
}
else if(num.at(0)=='G'){
num_a[0]=1;
num_a[1]=6;
}
else if(num.at(0)=='H'){
num_a[0]=1;
num_a[1]=7;
}
else if(num.at(0)=='I'){
num_a[0]=3;
num_a[1]=4;
}
else if(num.at(0)=='J'){
num_a[0]=1;
num_a[1]=8;
}
else if(num.at(0)=='K'){
num_a[0]=1;
num_a[1]=9;
}
else if(num.at(0)=='L'){
num_a[0]=2;
num_a[1]=0;
}
else if(num.at(0)=='M'){
num_a[0]=2;
num_a[1]=1;
}
else if(num.at(0)=='N'){
num_a[0]=2;
num_a[1]=2;
}
else if(num.at(0)=='O'){
num_a[0]=3;
num_a[1]=5;
}
else if(num.at(0)=='P'){
num_a[0]=2;
num_a[1]=3;
}
else if(num.at(0)=='Q'){
num_a[0]=2;
num_a[1]=4;
}
else if(num.at(0)=='R'){
num_a[0]=2;
num_a[1]=5;
}
else if(num.at(0)=='S'){
num_a[0]=2;
num_a[1]=6;
}
else if(num.at(0)=='T'){
num_a[0]=2;
num_a[1]=7;
}
else if(num.at(0)=='U'){
num_a[0]=2;
num_a[1]=8;
}
else if(num.at(0)=='V'){
num_a[0]=2;
num_a[1]=9;
}
else if(num.at(0)=='W'){
num_a[0]=3;
num_a[1]=2;
}
else if(num.at(0)=='X'){
num_a[0]=3;
num_a[1]=0;
}
else if(num.at(0)=='Y'){
num_a[0]=3;
num_a[1]=1;
}
else if(num.at(0)=='Z'){
num_a[0]=3;
num_a[1]=3;
}
/* tatol=num_a[0]+num_a[1]*9;*/
int j=1;
/* for(int i=8;i>=1;i++){
tatol+=num.at(j)*i;
j++;
}
cout<<tatol+num.at(9);*/
for(int i=2;i<11;i++){
num_a[i]=num.at(j)-'0';
j++;
}
tatol=num_a[0]+num_a[10]+num_a[9]+(num_a[1]*9)+(num_a[2]*8)+(num_a[3]*7)+(num_a[4]*6)+(num_a[5]*5)+(num_a[6]*4)+(num_a[7]*3)+(num_a[8]*2);
// cout<<num_a[0]+num_a[1]<<"\n";
if(tatol%10==0)
cout<<"real\n";
else cout<<"fake\n";
}
}