S = input() ans = "NA" E = 0 W = 0 for i in range(len(S)): if S[i] == "O": W = 0 E += 1 else: E = 0 W += 1 if E == 3: ans = "East" break elif W == 3: ans = "West" break print(ans)