S = str(input().rstrip()) if "OOO" in S: print("East") exit() if "XXX" in S: print("West") exit() print("NA")