S = input().rstrip() e = 0 w = 0 for s in S: if s == "O": w = 0 e += 1 if e == 3: print("East") break elif s == "X": e = 0 w += 1 if w == 3: print("West") break else: print("NA")