

num = int(eval(input()))

travels = []

for _ in range(num):

    travels.append(list(map(int, input().split())))





beforTime = 0

beforX = 0

beforY = 0

resultFrag = True

for travel in travels:

    move = abs(beforX - travel[1]) + abs(beforY - travel[2])

    canMoveTime = travel[0] - beforTime

    if move <= canMoveTime and (move + canMoveTime) % 2 == 0:

        beforTime = travel[0]

        beforX = travel[1]

        beforY =  travel[2]

        continue

    resultFrag = False

    break



print(("Yes" if resultFrag else "No"))
num = int(eval(input()))





beforTime = 0

beforX = 0

beforY = 0

resultFrag = True

for travel in range(num):

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

    move = abs(beforX - x) + abs(beforY - y)

    canMoveTime = time - beforTime

    if move <= canMoveTime and (move + canMoveTime) % 2 == 0:

        beforTime = time

        beforX = x

        beforY =  y

        continue

    resultFrag = False

    break



print(("Yes" if resultFrag else "No"))
num = int(eval(input()))
travels = []
for _ in range(num):
    travels.append(list(map(int, input().split())))
beforTime = 0
beforX = 0
beforY = 0
resultFrag = True
for travel in travels:
    move = abs(beforX - travel[1]) + abs(beforY - travel[2])
    canMoveTime = travel[0] - beforTime
    if move <= canMoveTime and (move + canMoveTime) % 2 == 0:
        beforTime = travel[0]
        beforX = travel[1]
        beforY = travel[2]
        continue
    resultFrag = False
    break
print(("Yes" if resultFrag else "No"))

num = int(eval(input()))
beforTime = 0
beforX = 0
beforY = 0
resultFrag = True
for travel in range(num):
    time, x, y = list(map(int, input().split()))
    move = abs(beforX - x) + abs(beforY - y)
    canMoveTime = time - beforTime
    if move <= canMoveTime and (move + canMoveTime) % 2 == 0:
        beforTime = time
        beforX = x
        beforY = y
        continue
    resultFrag = False
    break
print(("Yes" if resultFrag else "No"))

-travels = [] -for _ in range(num): -    travels.append(list(map(int, input().split()))) -for travel in travels: -    move = abs(beforX - travel[1]) + abs(beforY - travel[2]) -    canMoveTime = travel[0] - beforTime +for travel in range(num): +    time, x, y = list(map(int, input().split())) +    move = abs(beforX - x) + abs(beforY - y) +    canMoveTime = time - beforTime -        beforTime = travel[0] -        beforX = travel[1] -        beforY = travel[2] +        beforTime = time +        beforX = x +        beforY = y