n = int(eval(input()))

pt = 0

px, py = 0, 0

f = True

for i in range(n):

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

    dis = abs(px-x) + abs(py-y)

    dt = t - pt

    #print("dis{0} dt = {1}".format(dis, dt))

    if dt >= dis and abs(dis - dt) % 2 == 0:

        pass

    else:

        f = False

    pt, px, py = t, x, y

print(("Yes" if f else "No"))

n = int(eval(input()))

can = True

time = 0

x = 0

y = 0

for _ in range(n):

    t, xx, yy = list(map(int,input().split()))

    distance = abs(x-xx) + abs(y - yy)

    difft = t - time

    if difft < distance:

        can = False

        break

    if (distance - difft) % 2 == 1:

        can = False

        break





    x = xx

    y = yy

    time = t

print(("Yes" if can else "No"))
n = int(eval(input()))
pt = 0
px, py = 0, 0
f = True
for i in range(n):
    t, x, y = list(map(int, input().split()))
    dis = abs(px - x) + abs(py - y)
    dt = t - pt
    # print("dis{0} dt = {1}".format(dis, dt))
    if dt >= dis and abs(dis - dt) % 2 == 0:
        pass
    else:
        f = False
    pt, px, py = t, x, y
print(("Yes" if f else "No"))

n = int(eval(input()))
can = True
time = 0
x = 0
y = 0
for _ in range(n):
    t, xx, yy = list(map(int, input().split()))
    distance = abs(x - xx) + abs(y - yy)
    difft = t - time
    if difft < distance:
        can = False
        break
    if (distance - difft) % 2 == 1:
        can = False
        break
    x = xx
    y = yy
    time = t
print(("Yes" if can else "No"))

-pt = 0 -px, py = 0, 0 -f = True -for i in range(n): -    t, x, y = list(map(int, input().split())) -    dis = abs(px - x) + abs(py - y) -    dt = t - pt -    # print("dis{0} dt = {1}".format(dis, dt)) -    if dt >= dis and abs(dis - dt) % 2 == 0: -        pass -    else: -        f = False -    pt, px, py = t, x, y -print(("Yes" if f else "No")) +can = True +time = 0 +x = 0 +y = 0 +for _ in range(n): +    t, xx, yy = list(map(int, input().split())) +    distance = abs(x - xx) + abs(y - yy) +    difft = t - time +    if difft < distance: +        can = False +        break +    if (distance - difft) % 2 == 1: +        can = False +        break +    x = xx +    y = yy +    time = t +print(("Yes" if can else "No"))