fun main(args: Array<String>) = println(run {
    val s = readLine()!!
    val t = readLine()!!

    val a = s.toList().sorted().joinToString("")
    val b = t.toList().sortedDescending().joinToString("")
    if (a<b) "Yes" else "No"

})
