def difference(two_lists):

    return [abs(two_lists[1][i] - two_lists[0][i]) for i in range(3)]





n = int(eval(input()))



txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]

dtxy = list(map(difference, list(zip(txy, txy[1:]))))



for i in range(n):

    dt, dx, dy = dtxy[i]

    if  dx + dy > dt or (dt - dx - dy) % 2:

        print("No")

        exit()

print("Yes")
n = int(eval(input()))



for _ in range(n):

    t, x, y = list(map(int, input().split()))

    if  x + y > t or (t - x - y) % 2:

        print("No")

        exit()

print("Yes")
def difference(two_lists):
    return [abs(two_lists[1][i] - two_lists[0][i]) for i in range(3)]


n = int(eval(input()))
txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]
dtxy = list(map(difference, list(zip(txy, txy[1:]))))
for i in range(n):
    dt, dx, dy = dtxy[i]
    if dx + dy > dt or (dt - dx - dy) % 2:
        print("No")
        exit()
print("Yes")

n = int(eval(input()))
for _ in range(n):
    t, x, y = list(map(int, input().split()))
    if x + y > t or (t - x - y) % 2:
        print("No")
        exit()
print("Yes")

-def difference(two_lists): -    return [abs(two_lists[1][i] - two_lists[0][i]) for i in range(3)] - - -txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)] -dtxy = list(map(difference, list(zip(txy, txy[1:])))) -for i in range(n): -    dt, dx, dy = dtxy[i] -    if dx + dy > dt or (dt - dx - dy) % 2: +for _ in range(n): +    t, x, y = list(map(int, input().split())) +    if x + y > t or (t - x - y) % 2: