S = input() e = S.find('OOO') w = S.find('XXX') if e == -1 and w == -1: print('NA') elif e < w: print('East') else: print('West')