s = eval(input())

t = eval(input())

s = sorted(s)

t = sorted(t, reverse=True)

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

if s == t:

    print("No")

    exit()

if len(s) < len(t) and s == t[:len(s)]:

    print("Yes")

    exit()

else:

    for i in range(u):

        if s[i] > t[i]:

            print("No")

            exit()

        elif s[i] == t[i]:

            pass

        else:

            print("Yes")

            exit()

    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 = eval(input())
t = eval(input())
s = sorted(s)
t = sorted(t, reverse=True)
u = min(len(s), len(t))
if s == t:
    print("No")
    exit()
if len(s) < len(t) and s == t[: len(s)]:
    print("Yes")
    exit()
else:
    for i in range(u):
        if s[i] > t[i]:
            print("No")
            exit()
        elif s[i] == t[i]:
            pass
        else:
            print("Yes")
            exit()
    print("No")

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

-u = min(len(s), len(t)) -if s == t: +if s < t: +    print("Yes") +else: -    exit() -if len(s) < len(t) and s == t[: len(s)]: -    print("Yes") -    exit() -else: -    for i in range(u): -        if s[i] > t[i]: -            print("No") -            exit() -        elif s[i] == t[i]: -            pass -        else: -            print("Yes") -            exit() -    print("No")