main :: IO ()
main = do
  s <- qs <$> getLine
  t <- reverse . qs <$> getLine
  putStrLn $ if t > s then "Yes" else "No"
 
qs :: String -> String
qs [] = []
qs [x] = [x]
qs (x:xs) =
  qs (filter (<x) xs) ++ [x] ++ qs (filter (>=x) xs)