
let () =
  let s = read_line () |> array_of_string in
  let t = read_line () |> array_of_string in
  Array.sort (fun x y -> int_of_char x - int_of_char y) s;
  Array.sort (fun x y -> int_of_char y - int_of_char x) t;
  print_endline @@
    if string_of_array s < string_of_array t then "Yes" else "No"


