# input s = input() win_east = s.find('OOO') win_west = s.find('XXX') # process if win_east != -1 or win_west != -1: if win_west == -1: print('East') elif win_east == -1: print('West') else: if win_west < win_east: print('West') else: print('East') elif (win_east != -1 and win_west != -1) or (win_east == -1 and win_west == -1): print('NA')