A0, B0, C0 = map(int, input().split(".")) A1, B1, C1 = map(int, input().split(".")) if (A0 < A1 or A0 == A1 and B0 < B1 or A0 == A1 and B0 == B1 and C0 < C1): print("NO") else: print("YES")