import Data.List

($>) :: (Functor m) => m a -> (a -> b) -> m b
infixl 1 $>
x $> f = fmap f x

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