import Data.List

solver::String->String->String
solver s t = let s'= sort s in
             let t'= reverse (sort t) in
             if s' < t' then "Yes\n" else "No\n"

main::IO()
main=do
  s<-getLine
  t<-getLine
  putStr (solver s t)