A = list(input().split(".")) B = list(input().split(".")) for i in range(3) : if int(A[i]) < int(B[i]) : ans = "NO" break else : ans = "YES" print(ans)