s = eval(input())

t = eval(input())

anas = sorted(s)

at = sorted(t,reverse = True)



miji = min(len(s),len(t))

for i in range(miji):

    if ord(anas[i]) < ord(at[i]):

        print('Yes')

        exit()

    elif ord(anas[i]) > ord(at[i]):

        print('No')

        exit()



if len(s) < len(t):

    print('Yes')

else:

    print('No')





s = eval(input())

t = eval(input())

anas = sorted(s)

at = sorted(t,reverse = True)



if anas < at:

    print('Yes')

else:

    print('No')

s = eval(input())
t = eval(input())
anas = sorted(s)
at = sorted(t, reverse=True)
miji = min(len(s), len(t))
for i in range(miji):
    if ord(anas[i]) < ord(at[i]):
        print("Yes")
        exit()
    elif ord(anas[i]) > ord(at[i]):
        print("No")
        exit()
if len(s) < len(t):
    print("Yes")
else:
    print("No")

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

-miji = min(len(s), len(t)) -for i in range(miji): -    if ord(anas[i]) < ord(at[i]): -        print("Yes") -        exit() -    elif ord(anas[i]) > ord(at[i]): -        print("No") -        exit() -if len(s) < len(t): +if anas < at: