S = input() l = len(S); S += 'OOOXXX' e = S.find('OOO') w = S.find('XXX') if e >=len and w >=len: print('NA') elif e < W: print('East') else: print('West')