fun main(args: Array<String>) {
    val s = readLine()!!.toList().sorted().fold(""){ acc,c->acc+c }
    val t = readLine()!!.toList().sorted().fold(""){ acc,c->acc+c }.reversed()
    println( if(s<t) "Yes" else "No" )
}