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