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

main = do
  s <- getLine
  t <- getLine
  let s' = sort s
  let t' = sortBy (flip compare) t
  putStrLn $ if s'<t' then "Yes" else "No"