S = input() for i in range(len(S)-2): if S[i:i+3] == 'OOO': print('East') exit() elif S[i:i+3] == 'XXX': print('West') exit() print('NA')