object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val s, t = sc.next()
  val result =
    if (s.toSeq.sorted.unwrap < t.toSeq.sorted(Ordering[Char].reverse).unwrap) {
      "Yes"
    } else {
      "No"
    }
  println(result)
}
