s = eval(input())

t = eval(input())

if "".join(sorted(s)) < "".join(sorted(t,reverse=True)):

    print("Yes")

else:

    print("No")
def main():

    S = [s for s in eval(input())]

    T = [t for t in eval(input())]

    S.sort()

    T.sort(reverse=True)

    if S < T:

        print("Yes")

    else:

        print("No")





if __name__ == '__main__':

    main()

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

def main():
    S = [s for s in eval(input())]
    T = [t for t in eval(input())]
    S.sort()
    T.sort(reverse=True)
    if S < T:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

-s = eval(input()) -t = eval(input()) -if "".join(sorted(s)) < "".join(sorted(t, reverse=True)): -    print("Yes") -else: -    print("No") +def main(): +    S = [s for s in eval(input())] +    T = [t for t in eval(input())] +    S.sort() +    T.sort(reverse=True) +    if S < T: +        print("Yes") +    else: +        print("No") + + +if __name__ == "__main__": +    main()