A = input().split(".") B = input().split(".") if A[0] > B[0]: print("YES") elif A[0] == B[0]: if A[1] > B[1]: print("YES") elif A[1] == B[1]: if A[2] >= B[2]: print("YES") else: print("NO")