S = input() east_index = S.find('OOO') west_index = S.find('XXX') if east_index and west_index: print('East' if east_index < west_index else 'West') else: print('East' if east_index else 'West' if west_index else 'NA')