s=list(eval(input()))

t=list(eval(input()))

s.sort()

t.sort(reverse=True)

print(("YNeos"[s>=t::2]))

if __name__ == '__main__':

    s = list(eval(input()))

    t = list(eval(input()))

    s.sort()

    t.sort(reverse=True)

    if s < t:

        print("Yes")

    else:

        print("No")

s = list(eval(input()))
t = list(eval(input()))
s.sort()
t.sort(reverse=True)
print(("YNeos"[s >= t :: 2]))

if __name__ == "__main__":
    s = list(eval(input()))
    t = list(eval(input()))
    s.sort()
    t.sort(reverse=True)
    if s < t:
        print("Yes")
    else:
        print("No")

-s = list(eval(input())) -t = list(eval(input())) -s.sort() -t.sort(reverse=True) -print(("YNeos"[s >= t :: 2])) +if __name__ == "__main__": +    s = list(eval(input())) +    t = list(eval(input())) +    s.sort() +    t.sort(reverse=True) +    if s < t: +        print("Yes") +    else: +        print("No")