CodeEff/ECCO huggingface dataset:
# Original solution
n = int(eval(input()))
l = [list(map(int, input().split())) for _ in range(n)]

x = y = t = 0
for i in range(n):
    dx, dy, dt = l[i][1], l[i][2], l[i][0]
    dist = abs((dx - x) + (dy - y))

    if abs(dt - t) < dist:
        print("No")
        exit()
    if abs(dt - t) % 2:
        if dist % 2 == 0:
            print("No")
            exit()
    else:
        if dist % 2 == 1:
            print("No")
            exit()
    x, y, t = dx, dy, dt
print("Yes")

# Optimized solution
n = int(eval(input()))
l = [list(map(int, input().split())) for _ in range(n)]

x = y = t = 0
for i in range(n):
    dx, dy, dt = l[i][1], l[i][2], l[i][0]
    dist = abs((dx - x) + (dy - y))

    if abs(dt - t) < dist or (dt - t - dist) % 2:
        print("No")
        exit()

    x, y, t = dx, dy, dt
print("Yes")
# Original solution
n = int(eval(input()))
plan_list = list()
#最初に0,0の座標を定義しなさい
plan_list.append([0,0,0])

for i in range(n):
    plan_list.append(list(map(int,input().split())))
    
for i in range(n):
    t_margin = abs(plan_list[i+1][0] - plan_list[i][0])
    x_margin = abs(plan_list[i+1][1] - plan_list[i][1])
    y_margin = abs(plan_list[i+1][2] - plan_list[i][2])
    xy_margin = x_margin + y_margin
    if t_margin < xy_margin or xy_margin % 2 != t_margin % 2:
        print("No")
        break
else:
    print("Yes")

# Optimized solution
n = int(eval(input()))

t_list = [0]
x_list = [0]
y_list = [0]

for i in range(n):
    t,x,y = list(map(int,input().split()))
    t_list.append(t)
    x_list.append(x)
    y_list.append(y)
    
for i in range(1,n+1):
    t_margin = t_list[i] - t_list[i-1]
    x_margin = abs(x_list[i] - x_list[i-1])
    y_margin = abs(y_list[i] - y_list[i-1])
    t_temp = t_margin%2
    xy_temp = (x_margin+y_margin)%2
    if (t_temp != xy_temp) or (t_margin < x_margin + y_margin):
        print("No")
        break
else:
    print("Yes")
# Original solution
n = int(eval(input()))
ans = "Yes"
t,x,y = 0,0,0
for i in range(n):
    t1,x1,y1 = list(map(int,input().split()))
    td,dis = t1-t,x1+y1-x-y
    if td%2 != dis%2 or td < dis:
        ans = "No"
        break
    t,x,y = t1,x1,y1
print(ans)

# Optimized solution
from sys import stdin

input = stdin.readline
lines = stdin.readlines

n = int(eval(input()))

txy = ((list(map(int, line.split()))) for line in lines())
ans = "Yes"
t,x,y = 0,0,0

for t1,x1,y1 in txy:
    
    td,dis = t1-t,abs(x1-x)+abs(y1-y)
    if td%2 != dis%2 or td < dis:
        ans = "No"
        break
    t,x,y = t1,x1,y1
print(ans)
# Original solution
n=int(eval(input()))
t=[list(map(int,input().split()))for i in range(n)]
t.insert(0,[0,0,0])
for i in range(n):
    dxy=abs(t[i][1]-t[i+1][1])+abs(t[i][2]-t[i+1][2])
    dt=abs(t[i][0]-t[i+1][0])
    dd=dt-dxy
    if dxy<=dt and dd%2==0:
        pass
    else:
        print("No")
        exit()
print("Yes")


# Optimized solution
n=int(input())
cnt=0
for i in range(n):
    t,x,y=map(int,input().split())
    if x+y<=t and t%2==(x+y)%2:
        cnt+=1
print("Yes") if cnt==n else print("No")
# Original solution
N = int(eval(input()))
txy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]
for i in range(N):
    t1, x1, y1 = txy[i]
    t2, x2, y2 = txy[i+1]
    if abs(x2-x1) + abs(y2-y1) <= t2 - t1 and (x1+y1+x2+y2) % 2 == (t2-t1) % 2:
        continue
    else:
        print('No')
        exit()
print('Yes')

# Optimized solution
N = int(eval(input()))
t0 = x0 = y0 = 0
for _ in range(N):
    t1, x1, y1 = list(map(int, input().split()))
    d = abs(x1 - x0) + abs(y1 - y0)
    if d > t1 - t0 or d % 2 != (t1 - t0) % 2:
        print('No')
        exit()
    t0, x0, y0 = t1, x1, y1
print('Yes')
# Original solution

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"))

# Optimized solution
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"))
# Original solution
N = int(eval(input()))

t0, x0, y0 = 0, 0, 0
for _ in range(N):
    t, x, y = list(map(int, input().split()))
    dt = t - t0
    dx = x - x0
    dy = y - y0
    dxy = abs(dx) + abs(dy)  #; print(dt, dx, dy, dxy) 
    isEvenOdd = (dt%2 == 0 and dxy%2 == 0) or (dt%2 != 0 and dxy%2 != 0)
    if isEvenOdd and dxy <= dt :
        t0, x0, y0 = t, x, y
    else:
        print('No')
        break
else:
    print('Yes')

# Optimized solution
N = int(eval(input()))

t0, x0, y0 = 0, 0, 0
for _ in range(N):
    t, x, y = list(map(int, input().split()))
    dt = t - t0
    dx = x - x0
    dy = y - y0
    dxy = abs(dx) + abs(dy)  #; print(dt, dx, dy, dxy) 
    if dt%2 == dxy%2 and dxy <= dt :
        t0, x0, y0 = t, x, y
    else:
        print('No')
        break
else:
    print('Yes')
# Original solution
import sys
N = int(eval(input()))
t, x, y = [], [], []
p_x, p_y = 0, 0
for i in range(N):
    t_t, x_t, y_t = list(map(int, input().split()))
    t.append(t_t)
    x.append(x_t)
    y.append(y_t)
for i in range(N):
    if int(t[i]) < int(x[i]) + int(y[i]) or t[i] % 2 != (x[i] + y[i]) % 2:
        print("No")
        sys.exit()
print("Yes")



# Optimized solution
N = int(eval(input()))
t, x, y = 0, 0, 0
for i in range(N):
    t_1, x_1, y_1 = list(map(int, input().split()))
    distance = abs(x - x_1) + abs(y - y_1)
    if distance > t_1 - t or (t_1 - t - distance) % 2 != 0:
        print("No")
        exit()
print("Yes")
# Original solution
n=int(eval(input()))
flag=True
ts=0
xs=0
ys=0
for i in range(n):
  te,xe,ye=list(map(int,input().split()))
  if (te-ts)%2 == ((xe+ye)-(xs+ys))%2 and ((xe+ye)-(xs+ys))<=(te-ts):
    flag = True
  else:
    flag = False
    break;
  ts,xs,ys=te,xe,ye
if flag:
  print('Yes')
else:
  print('No')

# Optimized solution
n=int(eval(input()))
arr=[[0,0,0]]+[list(map(int,input().split())) for _ in range(n)]
for i in range(n):
  t1,x1,y1=arr[i]
  t2,x2,y2=arr[i+1]
  if abs(x1-x2)+abs(y1-y2)>t2-t1:
    print('No')
    exit()
  if (abs(x1-x2)+abs(y1-y2))%2!=(t2-t1)%2:
    print('No')
    exit()
print('Yes')
# Original solution
n = int(eval(input()))
txy = [[int(0)] * 3]
txy += ([list(map(int, input().split())) for i in range(n)])

for i in range(n):
    t_diff = txy[i+1][0] - txy[i][0]
    xy_diff = (txy[i+1][1] + txy[i+1][2]) - (txy[i][1] + txy[i][2])

    if t_diff % 2 != xy_diff % 2 or xy_diff > t_diff:
        print("No")
        exit()

print("Yes")

# Optimized solution
n = int(eval(input()))
for i in range(n):
    t, x, y = list(map(int, input().split()))

    if (t + x + y) % 2 == 1 or (x + y) > t:
        print("No")
        exit()

print("Yes")
# Original solution
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')

# Optimized solution
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')
# Original solution
N = int(eval(input()))
for i in range(N):
    a,b,c = list(map(int,input().split()))
    if abs(b)+abs(c)>a or (a+b+c)%2==1:
        print("No")
        exit()
print("Yes")

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


import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, list(range(n, n - r, -1)), 1)
    denom = reduce(mul, list(range(1, r + 1)), 1)
    return numer // denom


def judge(s,g):
    t=g[0] - s[0]
    x=g[1] - s[1]
    y=g[2] - s[2]
    eprint('x,y,t ',end=':\n')
    eprint(x,y,t)
    if (abs(x)+abs(y))%2 == t%2 and (abs(x)+abs(y))<=t:
        return True
    else:
        return False


def main():
    n = int(input().strip())
    txy=[(0,0,0)]
    for i in range(n):
        tmp1, tmp2, tmp3 = list(map(int,input().strip().split()))
        txy.append((tmp1,tmp2,tmp3))
    txy.sort()
    n+=1

    for i in range(0,n-1):
        if judge(txy[i], txy[i+1]) != True:
            print("No")
            return
    print("Yes")

        




if __name__ == '__main__':
    main()

# Optimized solution


import sys
sys.setrecursionlimit(500000)


input = sys.stdin.readline


def judge(s, g):
    t = g[0] - s[0]
    x = g[1] - s[1]
    y = g[2] - s[2]
    if (abs(x)+abs(y)) % 2 == t % 2 and (abs(x)+abs(y)) <= t:
        return True
    else:
        return False


def main():
    # inputs
    n = int(input().strip())
    txy = [(0, 0, 0)]
    for i in range(n):
        tmp1, tmp2, tmp3 = list(map(int, input().strip().split()))
        txy.append((tmp1, tmp2, tmp3))
    txy.sort()
    n += 1

    # procedure and output
    for i in range(0, n-1):
        if judge(txy[i], txy[i+1]) != True:
            print("No")
            return
    print("Yes")


if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
t_ = 0
x_ = 0
y_ = 0
for i in range(n):
    t, x, y = list(map(int, input().split()))
    if abs(x-x_)+abs(y-y_) > t-t_:
        print('No')
        exit()
    else:
        r = (t-t_) - abs(x-x_)-abs(y-y_)
        if r%2 == 0:
            t_ = t
            x_ = x
            y_ = y
        else:
            print('No')
            exit()
else:
    print('Yes')

# Optimized solution
n = int(eval(input()))
t_ = 0
x_ = 0
y_ = 0
for i in range(n):
    t, x, y = list(map(int, input().split()))
    d = (t-t_)-abs(x-x_)-abs(y-y_)
    if d < 0 or d%2 != 0:
        print('No')
        exit()
    else:
        t_ = t
        x_ = x
        y_  = y

else:
    print('Yes')
# Original solution
n = int(eval(input()))
t_ = 0
x_ = 0
y_ = 0
for i in range(n):
    t, x, y = list(map(int, input().split()))
    d = (t-t_)-abs(x-x_)-abs(y-y_)
    if d < 0 or d%2 != 0:
        print('No')
        exit()
    else:
        t_ = t
        x_ = x
        y_  = y

else:
    print('Yes')


# Optimized solution
n = int(eval(input()))
TXY = []
tc, xc, yc = 0, 0, 0
for i in range(n):
    t, x, y = list(map(int, input().split()))
    d = abs(x-xc)+abs(y-yc)
    if d > t-tc or (t-tc-d)%2 == 1:
        print('No')
        exit()
    else:
        tc, xc, yc = t, x, y
else:
    print('Yes')
# Original solution
n = int(eval(input()))
TXY = []
tc, xc, yc = 0, 0, 0
for i in range(n):
    t, x, y = list(map(int, input().split()))
    d = abs(x-xc)+abs(y-yc)
    if d > t-tc or (t-tc-d)%2 == 1:
        print('No')
        exit()
    else:
        tc, xc, yc = t, x, y
else:
    print('Yes')


# Optimized solution
n = int(eval(input()))
tc = 0
xc, yc = 0, 0
for i in range(n):
    t, x, y = list(map(int, input().split()))
    d = abs(x-xc)+abs(y-yc)
    if d > t-tc:
        print('No')
        exit()
    else:
        if (t-tc-d)%2 != 0:
            print('No')
            exit()
    xc, yc, tc = x, y, t
else:
    print('Yes')
# Original solution
N = int(eval(input()))
count = 0
T, X, Y = 0, 0, 0
for i in range(N):
    t, x, y = list(map(int, input().split()))
    if abs(x-X)+abs(y-Y) <= t-T and t % 2 == (x+y) % 2:
        count += 1
    T, X, Y = t, x, y
print(("Yes" if count == N else "No"))

# Optimized solution
# C - Traveling
# https://atcoder.jp/contests/abc086/tasks/arc089_a

# dt = ti+1 −ti
# dist = abs(xi+1 − xi)+abs(yi+1 − yi)

# キーポイント: パリティ
# x + y は毎秒ごとに必ず偶奇が入れ替わる。

n = int(eval(input()))

T = 0
X = 0
Y = 0

cnt = 0

for i in range(n):
    t,x,y= list(map(int,input().split()))

    if abs(x-X) + abs(y-Y) <= (t-T) and (x+y)%2 == t%2:
        cnt += 1
    T,X,Y = t,x,y
print(("Yes" if cnt == n else "No"))
# Original solution
N = int(eval(input()))
In = [list(map(int, input().split())) for _ in range(N)]

s = (0, 0)
t = 0
success = True

for move in In:
    before_x, before_y = s
    tn, after_x, after_y = move

    dist_xy = abs(after_x - before_x) + abs(after_y - before_y)
    walk = tn - t

    if walk < dist_xy:
        success *= False

    if walk % 2 == 0 and dist_xy % 2 != 0:
        success *= False
    elif walk % 2 != 0 and dist_xy % 2 == 0:
        success *= False

    s = (after_x, after_y)
    t = tn

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

# Optimized solution
N = int(eval(input()))
In = [list(map(int, input().split())) for _ in range(N)]

s = (0, 0)
t = 0
success = True

for move in In:
    before_x, before_y = s
    tn, after_x, after_y = move

    dist_xy = abs(after_x - before_x) + abs(after_y - before_y)
    walk = tn - t

    if walk < dist_xy:
        success *= False
        break

    if walk % 2 == 0 and dist_xy % 2 != 0:
        success *= False
        break
    elif walk % 2 != 0 and dist_xy % 2 == 0:
        success *= False
        break

    s = (after_x, after_y)
    t = tn

print(("Yes" if success else "No"))
# Original solution
N = int(eval(input()))
previous_p = [{'t': 0, 'x': 0, 'y': 0}]
next_p = [{'t': t, 'x': x, 'y': y} for _ in range(N) for t, x, y in [list(map(int, input().split()))]]
previous_p += next_p

answer = 'Yes'
for p_p, n_p in zip(previous_p, next_p):
  time = n_p['t'] - p_p['t']
  distance = abs(n_p['x'] - p_p['x']) + abs(n_p['y'] - p_p['y'])
  if time < distance or time % 2 != distance % 2:
    answer = 'No'
    break
  
print(answer)

# Optimized solution
N = int(eval(input()))
p_t = 0
p_x = 0
p_y = 0
answer = 'Yes'
for _ in range(N):
  n_t, n_x, n_y = list(map(int, input().split()))
  time = n_t - p_t
  distance = abs(n_x - p_x) + abs(n_y - p_y)
  if time < distance or time % 2 != distance % 2:
    answer = 'No'
    break
  p_t = n_t
  p_x = n_x
  p_y = n_y
print(answer)
# Original solution
n=int(eval(input()))

li=[list(map(int,input().split())) for i in range(n)]
li.insert(0,[0,0,0])
#print(li)

for i in range(n) :
  cr=li[i]
  nx=li[i+1]
  dist=abs(nx[1]-cr[1])+abs(nx[2]-cr[2])
  dt=nx[0]-cr[0]
  if dt<dist :
    print("No")
    exit()
  if (dt%2) != (dist%2) :
    print("No")
    exit()
print("Yes")

# Optimized solution
n=int(eval(input()))
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
t_bef=0
x_bef=0
y_bef=0
flag='Yes'

for i in range(1,n+1):
    t,x,y=list(map(int,input().split()))
    dt=t-t_bef
    dist=abs(x-x_bef)+abs(y-y_bef)
    if (dt%2 != dist%2) or dist>dt:
        flag='No'
        #break
    t_bef,x_bef,y_bef=t,x,y

print(flag)
# Original solution
n=int(eval(input()))
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
t_bef=0
x_bef=0
y_bef=0
flag='Yes'

for i in range(1,n+1):
    t,x,y=list(map(int,input().split()))
    dt=t-t_bef
    dist=abs(x-x_bef)+abs(y-y_bef)
    if (dt%2 != dist%2) or dist>dt:
        flag='No'
        #break
    t_bef,x_bef,y_bef=t,x,y

print(flag)

# Optimized solution
n=int(eval(input()))
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
t_bef=0
x_bef=0
y_bef=0
flag='Yes'

for i in range(1,n+1):
    t,x,y=list(map(int,input().split()))
    dt=t-t_bef
    dist=abs(x-x_bef)+abs(y-y_bef)
    if (dt%2 != dist%2) or dist>dt:
        flag='No'
        break
    t_bef,x_bef,y_bef=t,x,y

print(flag)
# Original solution
N=int(eval(input()))
x=[0]
y=[0]
t=[0]

flag=1
for i in range(1,N+1):
  t_tmp,x_tmp,y_tmp=list(map(int,input().split()))
  t.append(t_tmp)
  x.append(x_tmp)
  y.append(y_tmp)
  time=abs(t[i-1]-t[i])
  d=abs(x[i-1]-x[i])+abs(y[i-1]-y[i])
  if d>time or (d%2)!=(time%2):
    print("No")
    flag=0
    break
    
if flag==1:
  print("Yes")

# Optimized solution
N = int(eval(input())) 
pre_t = 0
pre_x = 0
pre_y = 0

for i in range(N):
    now_t,now_x,now_y = list(map(int,input().split()))
    d = abs(now_x - pre_x) + abs(now_y - pre_y)
    t = now_t - pre_t
    if d <= t and t % 2 == d % 2:
        flg = 1
    else:
        flg = 0
        break

if flg == 1:
    print('Yes')
else:
    print('No')
# Original solution
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem C


class TravelingPlan(object):

    def __init__(self):
        from collections import OrderedDict
        self._points = OrderedDict()

    def add_point(self, name: str):
        if name not in self._points:
            self._points[name] = Point()
        return self._points[name]

    def is_executable(self):
        for j in range(len(self._points) - 1):
            current_point = self._points[str(j + 1)]
            previous_point = self._points[str(j)]
            result = self._can_move(previous_point, current_point)

            if result is False:
                return False
        return True

    def _can_move(self, previous_point, current_point):
        delta_x = current_point.x - previous_point.x
        delta_y = current_point.y - previous_point.y
        delta_x_y = delta_x + delta_y
        delta_t = current_point.t - previous_point.t

        if delta_x_y == delta_t:
            return True
        elif delta_x_y < delta_t:
            return self._is_reachable(delta_x_y, delta_t)
        elif delta_x_y > delta_t:
            return False

    def _is_reachable(self, delta_x_y, delta_t):
        for i in range(delta_t + 1):
            if (1 * i + (-1) * (delta_t - i)) == delta_x_y:
                return True
        return False


class Point(object):

    def __init__(self):
        self._x = 0
        self._y = 0
        self._t = 0

    @property
    def x(self):
        return self._x

    @x.setter
    def x(self, value):
        self._x = value

    @property
    def y(self):
        return self._y

    @y.setter
    def y(self, value):
        self._y = value

    @property
    def t(self):
        return self._t

    @t.setter
    def t(self, value):
        self._t = value


if __name__ == '__main__':
    point_count = int(eval(input()))
    points = [list(map(int, input().split(" "))) for _ in range(point_count)]
    plan = TravelingPlan()
    origin = plan.add_point(str(0))

    for i in range(0, len(points)):
        point = plan.add_point(str(i + 1))
        point.t = points[i][0]
        point.x = points[i][1]
        point.y = points[i][2]

    if plan.is_executable() is True:
        print("Yes")
    else:
        print("No")


# Optimized solution
# -*- coding: utf-8 -*-


def main():
    n = int(eval(input()))
    ts, xs, ys = [0], [0], [0]

    for i in range(n):
        ti, xi, yi = list(map(int, input().split()))
        ts.append(ti)
        xs.append(xi)
        ys.append(yi)

    for j in range(n):
        dt = ts[j + 1] - ts[j]
        dxy = (xs[j + 1] - xs[j]) + (ys[j + 1] - ys[j])

        if (-dt <= dxy <= dt) and (dt % 2 == dxy % 2):
            pass
        else:
            print('No')
            exit()

    print('Yes')


if __name__ == '__main__':
    main()
# Original solution
n=int(eval(input()))
t=[0]*(n+1)
x=[0]*(n+1)
y=[0]*(n+1)
for i in range(n):
    t[i+1],x[i+1],y[i+1] = list(map(int,input().split()))

flag=True
for i in range(n):
    time=t[i+1]-t[i]
    dist=abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
    if dist>time:
        flag=False
    if dist%2 != time%2:
        flag=False
if flag == True:
    print('Yes')
else:
    print('No')

# Optimized solution
n=int(eval(input()))
t=[0]*(n+1)
x=[0]*(n+1)
y=[0]*(n+1)
for i in range(1,n+1):
    t[i],x[i],y[i]=list(map(int,input().split()))
time=0
dist=0
for i in range(n):
    dist=abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
    time=t[i+1]-t[i]
    if time>=dist and time%2 == dist%2:
        continue
    else:
        print('No')
        exit()
print('Yes')
# Original solution
N = int(eval(input()))
t = [list(map(int, input().split())) for i in range(N)]

if N == 1:
    if t[0][0] >= t[0][1] + t[0][2]:
        print("Yes")
    else:
        print("No")

else:
    for i in range(1,N):
        a = t[i][0] - t[i-1][0]
        b = abs(t[i][1] - t[i-1][1]) + abs(t[i][2] - t[i-1][2])
        if a >= b and a % 2 == b % 2:
            continue
        else:
            print("No")
            exit()
    print("Yes")

# Optimized solution
N = int(eval(input()))
pt, px, py = 0, 0, 0
for i in range(N):
    t, x, y = list(map(int, input().split()))
    a = abs(x - px) + abs(y - py)
    b = t - pt
    if b < a or (a - b) % 2 != 0:
        print("No")
        exit()
    pt, px, py = t, x, y
print("Yes")
# Original solution
n = int(eval(input()))
t, x, y = 0, 0, 0
ans = "Yes"
for i in range(1, n+1):
  ti, xi, yi = list(map(int, input().split()))
  displacements = (xi - x) + (yi - y)
  dist = abs(displacements)
  dt = ti - t
  if dt >= dist and (dt - dist) % 2 == 0:
    t, x, y = ti, xi, yi
  else:
    ans = "No"
  
  if ans == "No":
    break
 
print(ans)

# Optimized solution
n = int(eval(input()))
t, x, y = 0, 0, 0
ans = "Yes"
for i in range(1, n+1):
  ti, xi, yi = list(map(int, input().split()))
  displacements = (xi - x) + (yi - y)
  dist = abs(displacements)
  dt = ti - t
  if dt >= dist and (dt - dist) % 2 == 0:
    t, x, y = ti, xi, yi
  else:
    ans = "No"
    break

print(ans)
# Original solution
n = int(eval(input()))
t, x, y = 0, 0, 0
ans = "Yes"
for i in range(1, n+1):
  ti, xi, yi = list(map(int, input().split()))
  displacements = (xi - x) + (yi - y)
  dist = abs(displacements)
  dt = ti - t
  if dt >= dist and (dt - dist) % 2 == 0:
    t, x, y = ti, xi, yi
  else:
    ans = "No"
 
print(ans)

# Optimized solution
#                         author:  kagemeka 
#                         created: 2019-11-06 12:47:30(JST)
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics

def main():
    n, *txy = (int(x) for x in sys.stdin.read().split())
    t, x, y = [0], [0], [0]
    for i in range(0, n * 3, 3):
        t.append(txy[i])
        x.append(txy[i+1])
        y.append(txy[i+2])
    for i in range(n):
        dt = t[i+1] - t[i]
        distx = abs(x[i+1] - x[i])
        disty = abs(y[i+1] - y[i])
        if dt - (distx + disty) >= 0 and (dt - (distx + disty)) % 2 == 0:
            continue
        else:
            ans = 'No'        
            break
    else:
        ans = 'Yes'
    
    print(ans)

if __name__ == "__main__":
    # execute only if run as a script
    main()