# No.486 3 Straight Win(3連勝) s = input() if 'OOO' in s: print('East') elif 'XXX' in s: print('West') else: print('NA')