You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order.
a = input()
a = sorted(a)
b = input()
b = sorted(b)
ml = min(len(a),len(b))
cnt = 0
if a[0:ml+1] == b[0:ml+1]:
    if len(a) < len(b):
        print("Yes")
        cnt = 1
else:
    for i in range(ml):
        if a[i] < b[i]:
            print("Yes")
            cnt = 1
            break
if cnt == 0:print("No")
print("Yes" if sorted(input())<sorted(input())[::-1] else "No")