fun main(args: Array<String>) {
    abc082b()
}

fun abc082b() {
    val (s, t) = (1..2).map { readLine()!! }

    val answer =
        if (s.toCharArray().sorted().joinToString() < t.toCharArray().sortedDescending().joinToString()) "Yes" else "No"

    println(answer)
}
