print((function (s) local e,w=0,0 for i=1,#s do if s:sub(i,i)=="O" then e,w=e+1,0 else e,w=0,w+1 end if e==3 then return "East" end if w==3 then return "West" end end return "NA" end)(io.stdin:read("*l")))