import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    val sd = sc.next().toList().sorted().joinToString(separator = "")
    val td = sc.next().toList().sorted().reversed().joinToString(separator = "")

    val res = if (sd < td) "Yes" else "No"

    println(res)
}