import Data.List

main = do
  s <- getLine
  t <- getLine
  let ans = compute s t
  putStrLn $ if ans then "Yes" else "No"

compute :: String -> String -> Bool
compute s t = sort s < reverse (sort t)
