defmodule Main do
  def main do
    s = IO.read(:line) |> String.trim |> String.to_charlist |> Enum.sort(:asc)
    t = IO.read(:line) |> String.trim |> String.to_charlist |> Enum.sort(:desc)
    if t > s do
      IO.puts("Yes")
    else
      IO.puts("No")
    end
  end
end
