A = list(input().split(".")) B = list(input().split(".")) for i in range(3) : A[i] = int(A[i]) B[i] = int(B[i]) if (A[0] >= B[0]) and (A[1] >= B[1]) and (A[2] >= B[2]) : print("YES") else : print("NO")