s = eval(input())

s_asc = ''.join(sorted(s))



t = eval(input())

t_desc = ''.join(sorted(t, reverse=True))



if s_asc < t_desc:

	print('Yes')

else:

	print('No')
s = sorted(eval(input()))

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





if s < t:

	print("Yes")

else:

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

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

-s = eval(input()) -s_asc = "".join(sorted(s)) -t = eval(input()) -t_desc = "".join(sorted(t, reverse=True)) -if s_asc < t_desc: +s = sorted(eval(input())) +t = sorted(eval(input()), reverse=True) +if s < t: