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()

S = []
for i in range(len(s)):
    S.append(s[i])

T = []
for j in range(len(t)):
    T.append(t[j])

S.sort()
T.sort()

if(S<T):
    print("Yes")
else:
    print("No")
s = list(input())
t = list(input())

s.sort()
t.sort(reverse = True)

s = "".join(s)
t = "".join(t)

if s<t:
    print("Yes")
else:
    print("No")