s=eval(input())

t=eval(input())

print(("Yes"if"".join(sorted(s))<"".join(reversed(sorted(t)))else"No"))
print(("Yes"if"".join(sorted(eval(input())))<"".join(sorted(eval(input()))[::-1])else"No"))
s = eval(input())
t = eval(input())
print(("Yes" if "".join(sorted(s)) < "".join(reversed(sorted(t))) else "No"))

print(
    (
        "Yes"
        if "".join(sorted(eval(input()))) < "".join(sorted(eval(input()))[::-1])
        else "No"
    )
)

-s = eval(input()) -t = eval(input()) -print(("Yes" if "".join(sorted(s)) < "".join(reversed(sorted(t))) else "No")) +print( +    ( +        "Yes" +        if "".join(sorted(eval(input()))) < "".join(sorted(eval(input()))[::-1]) +        else "No" +    ) +)