# coding: utf-8 e = w = 0 for x in input(): if x == "O": e += 1 w = 0 else: w += 1 e = 0 if e == 3 or w == 3: break if e == 3: print("East") elif w == 3: print("West") else: print("NA")