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