import sys A = input().split(".") B = input().split(".") for x in range(len(B[0])): if int(B[0]) > int(A[0]): print("NO") sys.exit() if int(B[0]) < int(A[0]): print("YES") sys.exit() for x in range(len(B[1])): if int(B[1]) > int(A[1]): print("NO") sys.exit() if int(B[1]) < int(A[1]): print("YES") sys.exit() for x in range(len(B[2])): if int(B[2]) > int(A[2]): print("NO") sys.exit() if int(B[2]) <= int(A[2]): print("YES") sys.exit()