const main = args => {
  const [s, t] = args.split('\n').map(arg => arg.split(''));
  console.log(s.sort() < t.sort().reverse() ? 'Yes' : 'No');
};
main(require('fs').readFileSync('/dev/stdin', 'utf8'));