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

s1 = sorted(s)
s2 = "".join(s)
t1 = sorted(t, reverse=True)
t2 = "".join(t)

l = [s2, t2]
l.sort()

if l[0] == s2:
  print("Yes")
else:
  print("No")
s = input()
t = input()

s1 = sorted(s)
s2 = "".join(s1)
t1 = sorted(t, reverse=True)
t2 = "".join(t1)

l = [s2, t2]
l.sort()

if s == t:
  print("No")
elif l[0] == s2:
  print("Yes")
else:
  print("No")
