import           Control.Monad
import           Data.List
import           Data.Ord

main :: IO ()
main = do
  s <- sort <$> getLine
  t <- sortOn Down <$> getLine
  putStrLn
    $ if t > s
      then "Yes"
      else "No"