S=input() count=0 counter=0 for x in S: if x[0]=='O': count+=1 if count==3: print('East') else: count=0 if x[0]=='X': counter+=1 if counter==3: print('West') break else: counter=0 else: print('NA')