let f g s = let a = String.(Array.init (length s) @@ get s) in Array.(sort g a; String.init (length a) @@ get a)
let s = f compare @@ read_line ()
let t = f (fun x y -> compare y x) @@ read_line ()
let _ = print_endline @@ if s < t then "Yes" else "No"