local_table = {'A':10,'B':11,'C':12,'D':13,'E':14,'F':15,'G':16,'H':17,'I':34, 'J':18,'K':19,'L':20,'M':21,'N':22,'O':35,'P':23,'Q':24,'R':25, 'S':26,'T':27,'U':28,'V':29,'W':32,'X':30,'Y':31,'Z':33} while True: try: id_number = input() # 輸入身分證字號 check = False # 預設 check 為 False while True: try: # 使用 try,如果身分證字號有發生錯誤,會執行 except 區塊 id_arr = list(id_number) # 將身分證字號變成串列 if len(id_arr)!=10: break # 如果不足 10 碼就跳出 local = str(local_table[id_arr[0]]) # 取得地區碼對應的數字 check_arr = list(local) # 將地區碼對應的數字拆成串列 check_arr[0] = int(check_arr[0]) # 取得地區串列的第一個數字 check_arr[1] = int(check_arr[1]) * 9 # 取得地區串列的第二個數字乘以 9 sex = id_arr[1] # 性別代碼 if sex!='1' and sex!='2': break check_arr.append(int(sex)*8) # 性別代碼乘以 8 for i in range(7): check_arr.append(int(id_arr[i+2])*(7-i)) # 依序計算後續的代碼 check_num = 10 - sum(check_arr)%10 if check_num != int(id_arr[9]): break check = True break except: # 如果身分證字號錯誤,跳出迴圈 break if check == False: print('fake') else: print('real') except: break