s = eval(input())

t = eval(input())

S = sorted(s)

T = sorted(t,reverse=True)

if S < T:

    print("Yes")

else:

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

t = sorted(list(eval(input())),reverse=True)

s = "".join(s)

t = "".join(t)



if s < t:

    print("Yes")

else:

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

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

-s = eval(input()) -t = eval(input()) -S = sorted(s) -T = sorted(t, reverse=True) -if S < T: +s = sorted(list(eval(input()))) +t = sorted(list(eval(input())), reverse=True) +s = "".join(s) +t = "".join(t) +if s < t: