import sys def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def solve(): S = input() N = len(S) cnt_o = 0 cnt_x = 0 for c in S: if c == 'O': cnt_x = 0 cnt_o += 1 if cnt_o >= 3: print('East') return None else: cnt_o = 0 cnt_x += 1 if cnt_x >= 3: print('West') return None print('NA') if __name__ == '__main__': solve()