import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  s <- sort <$> getLine
  t <- reverse . sort <$> getLine
  putStrLn $ if s < t then "Yes" else "No"
