import Data.List
import Data.Ord
import Data.Char
import Data.Ratio
import Data.Maybe

main = do
  s <- getLine
  t <- getLine
  putStrLn $ if [(s',t')|s'<-permutations s, t'<-permutations t, s'<t']/=[]
    then "Yes"
    else "No"