import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines S = read() o = S.find(b'OOO') x = S.find(b'XXX') INF = 10 ** 9 if o == -1: o = INF if x == -1: x = INF if o < x: print('East') elif x < o: print('West') else: print('NA')