S = input() if "OOO" in S: print("East") elif "XXX" in S: print("West") else: print("NA")