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