let () =
  let s = read_line () in
  let t = read_line () in
  let s' = Array.init (String.length s) (fun i -> s.[i]) in
  let t' = Array.init (String.length t) (fun i -> t.[i]) in
  Array.sort compare s';
  Array.sort (fun x y -> compare y x) t';
  print_endline @@
    if String.init (Array.length s') (fun i -> s'.(i)) < String.init (Array.length t') (fun i -> t'.(i)) then "Yes" else "No"