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.
s = input()
t = input()

sorted_s = sorted(s)
sorted_t = sorted(t, reverse=True)

the_same = 0
flg = False
for S, T in zip(sorted_s, sorted_t):
    if ord(S) == ord(T):
        the_same += 1
        continue
    elif ord(S) > ord(T):
        print('No')
        flg = True
        break
    elif ord(S) < ord(T):
        print('Yes')
        flg = True
        break

if the_same == len(s) and len(s) < len(t) and not flg:
    print('Yes')
elif the_same == len(s) and len(s) > len(t) and not flg:
    print('No')
else:
    print('No')
s = input()
s_sort = ''.join(sorted(s))

t = input()
t_sort = ''.join(sorted(t, reverse=True))

if s_sort < t_sort:
    print('Yes')
else:
    print('No')