a, b = map(int, input().split(":")) x, y = map(int, input().split(":")) print("YES" if a >= x and b >= y else "NO")