#include<iostream>
#include<string>
using namespace std;
int main()
{
int a[1000] = {10,11,12,13,14,15,16,17,34,18,19,20,21,22,35,23,24,25,26,27,28,29,32,30,31,33};
int b=1,n=0,k = 0,sum=0;
string s;
while (getline(cin, s)) {
sum = 0;
for (int i = 'A'; i <= 'Z'; i++) {
if (s[0] == i) {
k = i - 'A';
if(19>a[k]&&a[k]>=10)
n = (a[k] / 10) + ((a[k] % 10) * 9);
else if(29>a[k]&&a[k]>=20)
n = (a[k] / 10) + ((a[k] % 20) * 9);
else if(39>a[k]&&a[k]>=30)
n = (a[k] / 10) + ((a[k] % 30) * 9);
}
}
for (int i = 8; i > 0; i--) {
sum = sum + ((s[b] - 48)*i);
b++;
}
sum = n + sum + (s[9]-48);
if (sum % 10 == 0)
cout << "real" << endl;
else
cout << "fake" << endl;
}
}