S = input() d = {"O": 0, "X": 0} n = {"O": "X", "X": "O"} for s in S: d[s] += 1 d[n[s]] = 0 if d[s]==3: if s=="O": print("East") else: print("West") exit() print("NA")