import Control.Applicative import Data.Bits main :: IO() main = do bef <- sum . zipWith (*) (iterate (*2) 1) . map convert <$> getLine n <- readLn aft <-sum . zipWith (*) (iterate (*2) 1) . map convert <$> getLine let nb = popCount bef let na = popCount aft putStrLn $ if nb /= na then "SUCCESS" else if bef == 0 || bef == 7 then "FAILURE" else case n of 0 -> if bef == aft then "FAILURE" else "SUCCESS" 1 | isLat bef && (bef == aft || isCen aft) -> "FAILURE" | isCen bef && isLat aft -> "FAILURE" | otherwise -> "SUCCESS" _ -> "FAILURE" isLat x = elem x [1,3,4,6] isCen x = elem x [2,5] convert :: Char -> Int convert x | x == 'o' = 0 | x == 'x' = 1