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