'use strict'

const main = input => {
	const args = input.trim().split('\n')
	const s = args[0].split('').sort((a, b) => a.charCodeAt() - b.charCodeAt()).join('')
	const t = args[1].split('').sort((a, b) => b.charCodeAt() - a.charCodeAt()).join('')
	if (s < t) console.log('Yes')
	else console.log('No')
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
