s = input() e = s.index("OOO") if e == -1: e = 101 w = s.index("XXX") if w == -1: w = 101 if e == 101: print("NA") elif e < w: print("East") else: print("West")