S=input() count=0 for word in S: if word[0]=='O': count+=1 elif word[0]=='X': count-=1 if count==3: print('East') elif count==-3: print('West') else: print('NA')