import Data.List
main = do
    s <- getLine
    t <- getLine
    putStrLn $ solve s t
solve :: String -> String -> String
solve s t = if s' < t' then "Yes" else "No"
    where s' = sort s
          t' = reverse.sort $ t