a=input();l=a.find('OOO');r=a.find('XXX') print("NA"if l== r else["East","West"][l==-1or(r!=-1and l>r)])