'use strict'

function main(input) {
  input = input
    .trim()
    .split('\n')
    .map(v => v.split(''))

  const s = input[0].sort()
  const t = input[1].sort().reverse()
  const concat = [s.slice(0), t.slice(0)].sort()
  const ans = concat[0].join('') == s.join('') ? 'Yes' : 'No'
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
