module Main where import Data.Bool import Data.List main :: IO () main = do { x <- getLine ; y <- getLine ; putStrLn $ bool "NO" "YES" (y `elem` permutations x) }