#include <iostream>
#include <string>
using namespace std;
int main()
{
string ss;
while(cin>>ss)
{
int index = ss[0] - 55;
switch(index)
{
case 18:
index = 34;
break;
case 24:
index = 35;
break;
case 33:
index = 30;
break;
case 34:
index = 31;
break;
case 35:
index = 33;
break;
}
if(index > 18 && index < 24)
{
index-=1;
}
else if(index >= 23 && index <= 33)
{
if(index != 32)
{
index -= 2;
}
}
if(ss[0]=='X')
{
index = 30;
}
else if(ss[0]=='Y')
{
index = 31;
}
else if(ss[0]=='Z')
{
index = 33;
}
int temp = index % 10;
temp *= 9;
index /= 10;
index += temp;
for(int i=1;i<ss.length()-1;i++)
{
ss[i] -= 48;
ss[i] *= (9-i);
index += ss[i];
}
index += (ss[ss.length()-1]-48);
if(index%10==0)
{
std::cout<<"real"<<std::endl;
}
else{
std::cout<<"fake"<<std::endl;
}
//cout<<index<<endl;
}
return 0;
}