s=input() e=s.find("O"*3) w=s.find("X"*3) print("NA" if e+w==-2 else ("East","West")[e>w])