let f s = Array.init (String.length s) @@ fun i -> s.[i]
let g cs = String.init (Array.length cs) @@ fun i -> cs.(i)
let s, t = Scanf.scanf " %s %s" @@ fun a b -> f a, f b
let _ = Array.sort compare s; Array.sort (fun x y -> compare y x) t;
  print_endline @@ if g s < g t then "Yes" else "No"