s = input() for i in range(0,len(s)-2,1): v = s[i:i+3] if v=="OOO": print("East") exit() elif v=="XXX": print("West") exit() print("NA")