s=input() c_e=0 c_w=0 for i in range(len(s)-2): if s[i]=='O' and s[i+1]=='O' and s[i+2]=='O': c_e+=1 break elif s[i]!='O' and s[i+1]!='O' and s[i+2]!='O': c_w+=1 break if c_e==1: print('East') elif c_w==1: print('West') else: print('NA')