s = input() for i in range(len(s)-2): if s[i:i+3] == "OOO": print("East") break elif s[i:i+3] == "XXX": print("West") break else: print("NA")