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.
ss = sorted([i for i in input()])
ts= sorted([i for i in input()],reverse = True)
check = True
for ins,intt in zip(ss,ts):
    if ins<intt:
        print("Yes")
        check = False
        break
    else:
        continue
if check == True and len(ss)<len(ts):
    print("Yes")
else:
    print("No")
s = sorted([i for i in input()])
t = sorted([i for i in input()],reverse =True)
if "".join(s)<"".join(t):
    print("Yes")
else:
    print("No")