module Main where

import           Control.Monad
import           Data.List
import           Data.Ord
import           Data.List.Split
import qualified Data.Vector.Unboxed as V

solve :: String -> String -> String
solve [] [] = "No"
solve _ [] = "No"
solve [] _ = "Yes"
solve (a:as) (b:bs)
  | b > a = "Yes"
  | b == a = solve as bs
  | otherwise = "No"

main :: IO ()
main = do
  s <- sort <$> getLine
  t <- sortOn Down <$> getLine
  putStrLn $ solve s t
