#OまたはXが3連続で続いたら勝敗が確定する OならEast XならWest それ以外はNA S = input() #両方含まれていない if 'OOO' not in S and 'XXX' not in S: print('NA') #OOOがあるがXXXがない elif 'OOO' in S and 'XXX' not in S: print('East') #XXXがあるがOOOがない elif 'XXX' in S and 'OOO' not in S: print('West') #両方含まれている場合、先に出現した方を出力する elif S.index('XXX') < S.index('OOO'): print('West') else: print('East')