s = input() i,j = None, None if 'ooo' in s: i=s.index('ooo') if 'xxx' in s: j = s.index('xxx') if (i is None) and (j is None): print('NA') elif (i is None) and j: print('West') elif i and (j is None): print('East') else: if i