S=input() east=S.find('OOO') west=S.find('XXX') if east == -1: east=999 if west == -1: west=999 if eastwest: print('West') else: print('NA')