a = list(map(int, input().split("."))) b = list(map(int, input().split("."))) ans = "NO" if a[0] >= b[0] and a[1] >= b[1] and a[2] >= b[2]: ans = "YES" print(ans)