s=input() e=0 w=0 if not 'OOO'in s and not 'XXX' in s: print('NA') else: for i in range(2,len(s)): if 'OOO' in s[:i+1]: print('East') break elif 'XXX' in s[:i+1]: print('West') break