n = int(eval(input()))

time_space = [(int(x) for x in input().split()) for i in range(n)]

pos = [0,0]

for t, x, y in time_space:

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

        print('No')

        exit()

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

for i in range(n):

    t, x, y = [int(x) for x in input().split()]

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

        print('No')

        exit()

print('Yes')
n = int(eval(input()))
time_space = [(int(x) for x in input().split()) for i in range(n)]
pos = [0, 0]
for t, x, y in time_space:
    if (x + y) > t or (x + y + t) % 2:
        print("No")
        exit()
print("Yes")

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

-time_space = [(int(x) for x in input().split()) for i in range(n)] -pos = [0, 0] -for t, x, y in time_space: +for i in range(n): +    t, x, y = [int(x) for x in input().split()]