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