import Data.List judge :: Eq a => [a] -> [a] -> Bool judge xs ys = elem ys $ permutations xs main :: IO () main = do a <- getLine b <- getLine if judge a b then putStrLn "YES" else putStrLn "NO"