judge ws = j 0 ws where j _ [] = "NA" j cnt ('O':rs) = e (cnt+1) rs j cnt ('X':rs) = w (cnt+1) rs e 3 _ = "East" e cnt ('O':rs) = e (cnt+1) rs e cnt rs = j 0 rs w 3 _ = "West" w cnt ('X':rs) = w (cnt+1) rs w cnt rs = j 0 rs main = do ws <- getLine putStrLn $ judge ws