S = eval(input())

T = eval(input())



sorted_S = sorted(S)

sorted_T = sorted(T, reverse=True)

if sorted_S < sorted_T:

  print("Yes")

else:

  print("No")

  
S = sorted(eval(input()))

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



if S >= T:

    print("No")

else:

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

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

-S = eval(input()) -T = eval(input()) -sorted_S = sorted(S) -sorted_T = sorted(T, reverse=True) -if sorted_S < sorted_T: +S = sorted(eval(input())) +T = sorted(eval(input()), reverse=True) +if S >= T: +    print("No") +else: -else: -    print("No")