s = input() east, west = 0, 0 for x in s: if x == "O": east += 1 west = 0 else: east = 0 west += 1 if east == 3: print("East") break if west == 3: print("West") break else: print("NA")