'use strict'
 
function main(s) {
  let first = s.split('\n')[0].split('').sort().join("");
  let second = s.split('\n')[1].split('').sort().reverse().join("");
  if(first <second){
  	console.log("Yes");
  } else {
  	console.log("No");
  }
  
}
 
main(require("fs").readFileSync("/dev/stdin", "utf8"));