S = input() for s0, s1, s2 in zip(S[:-2], S[1:-1], S[2:]): if s0 == s1 == s2: print("East" if s0 == "O" else "West") break else: print("NA")