#!/usr/bin/python

S = input()
team = {'O': 'East', 'X': 'West'}

win = ''
count = 0
for s in S:
    if win == s:
        count += 1
        if count == 3:
            print(team[win])
            exit()
    else:
        count = 1
        win = s
print ('NA')