import java.lang.StringBuilder

fun main(args: Array<String>) {
    val minimumS: String = StringBuilder().append(readLine()?.toCharArray()?.apply { sort() }).toString()
    val maximumT: String = StringBuilder().append(readLine()?.toCharArray()?.apply { sortDescending() }).toString()
    println(if (minimumS < maximumT) "Yes" else "No")
}