let () =
  let (s, t) = Scanf.scanf "%s %s" (fun x y -> (x, y)) in
  let s_list = List.sort compare (List.of_seq (String.to_seq s)) in
  let t_list = List.rev (List.sort compare (List.of_seq (String.to_seq t))) in
  let s_str = String.of_seq (List.to_seq s_list) in
  let t_str = String.of_seq (List.to_seq t_list) in
  let ans =
    if (String.compare s_str t_str) < 0
    then "Yes"
    else "No"
  in
  Printf.printf "%s\n" ans
