A = [int(i) for i in input().split(".")] B = [int(i) for i in input().split(".")] if A[0] < B[0]: print("NO") elif A[0] == B[0]: if A[1] < B[1]: print("NO") if A[2] < B[2]: print("NO") else: print("YES") else: print("YES")