import scala.io.{StdIn => in}

object Main extends App {
  val s = in.readLine
  val t = in.readLine

  val s2 = s.sorted
  val t2 = t.sorted.reverse

  val ans = if(s2 < t2) "Yes" else "No"
  println(ans)
}