N = int(eval(input()))

now_x = 0

now_y = 0

now_t = 0

Flag = False

for i in range(N):

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

    dx = abs(x - now_x)

    dy = abs(y - now_y)

    dt = abs(t - now_t)

    if (dt - (dx + dy)) % 2 != 0 or dt < (dx + dy):

        Flag = True

    now_x = x

    now_y = y

    now_t = t

print(("No" if Flag else "Yes"))
N = int(eval(input()))

now_t, now_x, now_y = 0, 0, 0

for i in range(N):

    next_t, next_x, next_y = list(map(int, input().split()))

    distance = abs(next_x - now_x) + abs(next_y - now_y)

    spent_time = next_t - now_t

    if spent_time < distance or distance % 2 != spent_time % 2:

        print('No')

        exit()

    now_t, now_x, now_y = next_t, next_x, next_y

print('Yes')
N = int(eval(input()))
now_x = 0
now_y = 0
now_t = 0
Flag = False
for i in range(N):
    t, x, y = list(map(int, input().split()))
    dx = abs(x - now_x)
    dy = abs(y - now_y)
    dt = abs(t - now_t)
    if (dt - (dx + dy)) % 2 != 0 or dt < (dx + dy):
        Flag = True
    now_x = x
    now_y = y
    now_t = t
print(("No" if Flag else "Yes"))

N = int(eval(input()))
now_t, now_x, now_y = 0, 0, 0
for i in range(N):
    next_t, next_x, next_y = list(map(int, input().split()))
    distance = abs(next_x - now_x) + abs(next_y - now_y)
    spent_time = next_t - now_t
    if spent_time < distance or distance % 2 != spent_time % 2:
        print("No")
        exit()
    now_t, now_x, now_y = next_t, next_x, next_y
print("Yes")

-now_x = 0 -now_y = 0 -now_t = 0 -Flag = False +now_t, now_x, now_y = 0, 0, 0 -    t, x, y = list(map(int, input().split())) -    dx = abs(x - now_x) -    dy = abs(y - now_y) -    dt = abs(t - now_t) -    if (dt - (dx + dy)) % 2 != 0 or dt < (dx + dy): -        Flag = True -    now_x = x -    now_y = y -    now_t = t -print(("No" if Flag else "Yes")) +    next_t, next_x, next_y = list(map(int, input().split())) +    distance = abs(next_x - now_x) + abs(next_y - now_y) +    spent_time = next_t - now_t +    if spent_time < distance or distance % 2 != spent_time % 2: +        print("No") +        exit() +    now_t, now_x, now_y = next_t, next_x, next_y +print("Yes")