#include <iostream>
using namespace std;
int main()
{
string a; //字串a:即輸入之該串身分證字號
while(cin >> a)
{
int alp,sum=0; //alp (alphabet):用以表示字母被轉換成 (十位數+個位數*9) 的結果
if(a[0] == 'A')alp = 1;
else if(a[0] == 'B')alp = 10;
else if(a[0] == 'C')alp = 19;
else if(a[0] == 'D')alp = 28;
else if(a[0] == 'E')alp = 37;
else if(a[0] == 'F')alp = 46;
else if(a[0] == 'G')alp = 55;
else if(a[0] == 'H')alp = 64;
else if(a[0] == 'I')alp = 39;
else if(a[0] == 'J')alp = 73;
else if(a[0] == 'K')alp = 82;
else if(a[0] == 'L')alp = 2;
else if(a[0] == 'M')alp = 11;
else if(a[0] == 'N')alp = 20;
else if(a[0] == 'O')alp = 48;
else if(a[0] == 'P')alp = 29;
else if(a[0] == 'Q')alp = 38;
else if(a[0] == 'R')alp = 47;
else if(a[0] == 'S')alp = 56;
else if(a[0] == 'T')alp = 65;
else if(a[0] == 'U')alp = 74;
else if(a[0] == 'V')alp = 83;
else if(a[0] == 'W')alp = 21;
else if(a[0] == 'X')alp = 3;
else if(a[0] == 'Y')alp = 12;
else if(a[0] == 'Z')alp = 30;
sum += alp;
for(int i=1,j=8; i<=8,j>=1; ++i,--j) //整數變數 i 跟 j 一起遞增減
{
sum = sum + (int(a[i])-48) * j; //由於a[i]是字串a的第(i+1)個字元,須轉成整數。又由於ASCII碼的關係,須將其值減去48,以得所求之值。
} //ASCII: 字元0 ==> 整數48;字元1 ==> 整數49;字元2 ==> 整數50,以此類推。
sum += int(a[9])-48;
if(sum % 10 == 0)cout << "real" << endl;
else cout << "fake" << endl;
}
return 0;
}