



import numpy as np



s=sorted(eval(input()))

t=sorted(eval(input()))

t.reverse()



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







import numpy as np



s="".join(sorted(eval(input())))

t="".join(sorted(eval(input()),reverse=True))



if(s<t):

    print("Yes")

else:

    print("No")
import numpy as np

s = sorted(eval(input()))
t = sorted(eval(input()))
t.reverse()
print(("Yes" if (s < t) else "No"))

import numpy as np

s = "".join(sorted(eval(input())))
t = "".join(sorted(eval(input()), reverse=True))
if s < t:
    print("Yes")
else:
    print("No")

-s = sorted(eval(input())) -t = sorted(eval(input())) -t.reverse() -print(("Yes" if (s < t) else "No")) +s = "".join(sorted(eval(input()))) +t = "".join(sorted(eval(input()), reverse=True)) +if s < t: +    print("Yes") +else: +    print("No")