s = list(input().strip())

s1 = sorted(s)

t = list(input().strip())

t1 = sorted(t,reverse=True)

if s1<t1:

    print("Yes")

else:

    print("No")
s = list(eval(input()))

t = list(eval(input()))

s = sorted(s)

t = sorted(t,reverse=True)

if s<t:

    print("Yes")

else:

    print("No")
s = list(input().strip())
s1 = sorted(s)
t = list(input().strip())
t1 = sorted(t, reverse=True)
if s1 < t1:
    print("Yes")
else:
    print("No")

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

-s = list(input().strip()) -s1 = sorted(s) -t = list(input().strip()) -t1 = sorted(t, reverse=True) -if s1 < t1: +s = list(eval(input())) +t = list(eval(input())) +s = sorted(s) +t = sorted(t, reverse=True) +if s < t: