def f(a): f=s.find(a*3) return 99 if f<0 else f s=input() e=f("O") w=f("X") print("NA" if e+w>197 else ("East","West")[e>w])