S = sorted(eval(input()))

T = sorted(eval(input()),reverse=True)

if S<T:

    print("Yes")

else:

    print("No")
S = sorted(eval(input()))

N = sorted(eval(input()))

N.reverse()

print(("Yes" if S < N  else "No"))
S = sorted(eval(input()))
T = sorted(eval(input()), reverse=True)
if S < T:
    print("Yes")
else:
    print("No")

S = sorted(eval(input()))
N = sorted(eval(input()))
N.reverse()
print(("Yes" if S < N else "No"))

-T = sorted(eval(input()), reverse=True) -if S < T: -    print("Yes") -else: -    print("No") +N = sorted(eval(input())) +N.reverse() +print(("Yes" if S < N else "No"))