peterverebics/CodeNet_Python_118 huggingface dataset:
n = int(input())
x = 0
y = 0
t = 0
ans = 'Yes'

for _ in range(n):
    ti, xi, yi = map(int, input().split())
    elapsed_time = ti - t
    if abs(x - xi) + abs(y - yi) > elapsed_time:
        ans = 'No'
        break
    dist_odd_even = (abs(x - xi) + abs(y - yi)) % 2
    time_odd_even = elapsed_time % 2
    if dist_odd_even != time_odd_even:
        ans = 'No'
        break
    x = xi
    y = yi
    t = ti

print(ans)
N = int(input())
for _ in range(N):
    t, x, y = map(int, input().split())
    if x + y > t or (t + x + y)%2 != 0:
        print("No")
        exit()
print("Yes")
N = int(input())

tmp = [tuple(map(int,input().split())) for i in range(N)]

ct = cx = cy = 0
for t,x,y in tmp:
    dst = abs(cx - x) + abs(cy - y)
    if dst > t-ct or dst%2 != (t-ct)%2:
        print('No')
        exit()
    ct,cx,cy = t,x,y
print('Yes')
import sys
_input = sys.stdin.readline


def resolve():
    N = int(_input())
    t, x, y = 0, 0, 0
    for _ in range(N):
        next_t, next_x, next_y = map(int, _input().split())
        diff_xy = abs(x - next_x) + abs(y - next_y)
        diff_t = next_t - t
        if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):
            print('No')
            exit(0)
    print('Yes')


if __name__ == '__main__':
    resolve()
# coding: utf-8
N=int(input())
L=[]
L.append([0,0,0])
Flg=True
cnt=0
for i in range(1,N+1):
    t,x,y=map(int,input().split())
    L.append([t,x,y])
    if (t-L[i-1][0]-(abs(L[i-1][1]-x)+abs(L[i-1][2]-y)))%2==0 and t-L[i-1][0]>=(abs(L[i-1][1]-x)+abs(L[i-1][2]-y)):
        cnt+=1
        
if cnt==N:
    print('Yes')
else:
    print('No')
n = int(input())
txy = [list(map(int,input().split())) for _ in range(n)]

flag = True
txy.insert(0,[0,0,0])
for i in range(n):
    t = txy[i+1][0] - txy[i][0]
    d = abs(txy[i+1][1] - txy[i][1]) + abs(txy[i+1][2]-txy[i][2])
    if t < d:
        flag = False
    elif t == d:
        continue
    elif (t-d) % 2 != 0:
        flag = False

if flag:
    print('Yes')
else:
    print('No')
n = int(input())
 
x0, y0, t0 = 0, 0, 0
 
for _ in range(n):
  t, x, y = map(int, input().split())
  if abs(x-x0) + abs(y-y0) > t-t0 or (x+y)%2 != t%2:
    status = "No"
    break
  else:
    status = "Yes"
    t0, x0, y0 = t, x, y
    
print(status)
import numpy as np
n = int(input())
grid = []
grid.append([0,0,0])
ans = "Yes"
for i in range(1,n+1):
    array = list(map(int,input().split()))
    grid.append(array)
for i in range(n):
    if np.abs(grid[i+1][1]-grid[i][1])+np.abs(grid[i+1][2]-grid[i][2]) > grid[i+1][0]-grid[i][0]:
        ans="No"
    elif (grid[i+1][0] - grid[i][0] - np.abs(grid[i+1][1]-grid[i][1]) - np.abs(grid[i+1][2]-grid[i][2])) % 2 == 1:
        ans="No"
print(ans)
n = int(input())
 
ti,xi,yi = 0,0,0
found = True
for _ in range(n):
    t, x, y = map(int, input().split())
    root = abs(x-xi)+abs(y-yi)
    if root > (t-ti) or (t-ti-root)&1:
        found = False
    ti,xi,yi = t,x,y  
    
print("Yes" if found else "No")
n=int(input())
txylist=[[0,0,0]]
for i in range(n):
    txy=list(map(int,input().split(" ")))
    txylist+=[txy]
for i in range(n):
    p=False
    t0,x0,y0=txylist[i]
    t1,x1,y1=txylist[i+1]
    t,x,y=t1-t0,x1-x0,y1-y0
    tt=abs(x)+abs(y)
    legs=t-tt
    if legs>=0 and legs%2==0:
        p=True
    else:
        print("No")
        break
if p==True:
    print("Yes")
N = int(input())
ex_t, ex_x, ex_y = 0, 0, 0
count = 0
for i in range(N):
    t, x, y = map(int, input().split())
    if abs(x-ex_x) + abs(y-ex_y) <= abs(t-ex_t) and t%2 == (x+y)%2:
        count += 1
    ex_t, ex_x, ex_y = t, x, y
print('Yes' if count == N else 'No')
n = int(input())
bt, bx, by = 0, 0, 0
flag = True
for i in range(n):
    nt, nx, ny = map(int, input().split())
    dist = abs(nx - bx) + abs(ny - by)
    diff_t = nt - bt
    if diff_t < dist or (diff_t - dist) % 2:
        flag = False
    bt, bx, by = nt, nx, ny
print('Yes' if flag else 'No')
n = int(input())
t_list = [list(map(int,input().split())) 
          for nesya in range(n)]
dame = 0
ti = 0
tx = 0
ty = 0
for t in t_list:
  time = t[0]
  x_t = t[1]
  y_t = t[2]
  d = abs(y_t-ty)+abs(x_t-tx)
  h = time - ti
  if d > h or (h-d)%2 == 1:
    dame += 1
    print('No')
    break
  ti = time
  tx = x_t
  ty = y_t
if dame == 0:
  print('Yes')
n = int(input())
# 初期位置
x_old, y_old, t_old = 0, 0, 0

for _ in range(n):
    # 都度読み込み
    t, x, y = map(int, input().split())
    d = (t - t_old) - abs(x - x_old) - abs(y - y_old)
    if d >= 0 and d % 2 == 0:
        x_old, y_old, t_old = x, y, t
    else:
        print('No')
        exit()

print('Yes')
import sys
input = sys.stdin.readline

n = int(input())
t = 0
x = 0
y = 0

l = [tuple(map(int, input().split())) for _ in range(n)]

for t1, x1, y1 in l:
    if (abs(x1 - x) + abs(y1 - y))/(t1 - t) > 1:
        print("No")
        exit()
    if (abs(x1 - x) + abs(y1 - y))%2 != (t1 - t)%2:
        print("No")
        exit()
    x = x1
    y = y1
    t = t1

print("Yes")
N = int(input())
t = [list(map(int, input().split())) for i in range(N)] #[t,x,y]
t.insert(0, [0,0,0]) #リストに場所指定して要素追加：（リスト名）.insert(インデックス番号, 要素)
flag = True
for i in range(N):
    dt = t[i+1][0] - t[i][0]
    dist = abs(t[i+1][1]-t[i][1]) + abs(t[i+1][2]-t[i][2])
    if dt < dist:
        flag = False
    if dt%2!=dist%2:
        flag = False
print('Yes' if flag else 'No')
n=int(input())
plan=[[int(s) for s in input().split()] for j in range(n)]
now =[0 for j in range(3)]
plan.insert(0,now)
ans=0
for i in range(n):
    dt=abs(plan[i+1][0]-plan[i][0])
    dx=abs(plan[i+1][1]-plan[i][1])
    dy=abs(plan[i+1][2]-plan[i][2])
    if dt>=dx+dy:
        if dt%2 == (dx+dy)%2:
            ans+=1
print("Yes" if ans==n else "No")
n=int(input())
a=[[int(i) for i in input().split()] for l in range(n)]
nx=0
ny=0
day=0
for x in a:
    tx=abs(x[1]-nx)
    ty=abs(x[2]-ny)
    tday=x[0]-day
    if (tx+ty-tday)%2==0 and tx+ty<=tday:
        nx=x[1]
        ny=x[2]
        day=x[0]
    else:
        print("No")
        break
else:print("Yes")
N = int(input())

ans = True
cx = 0
cy = 0
ct = 0
for _ in range(N):
    t, x, y = map(int, input().split())
    d = abs(cx - x) + abs(cy - y)
    dt = t - (ct + d)
    if dt % 2 == 0 and dt >= 0:
        cx = x
        cy = y
        ct = t
    else:
        ans = False
        break

if ans:
    print("Yes")
else:
    print("No")
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        n=int(input())
        l=[list(map(int,input().split())) for i in range(n)]
        l.insert(0,[0,0,0])
        for j in range(n):
            t,x,y=l[j+1][0]-l[j][0],l[j+1][1]-l[j][1],l[j+1][2]-l[j][2]
            if t<(abs(x)+abs(y))or t%2!=(abs(x)+abs(y))%2:
                return 'No'
        return 'Yes'
    print(main())
resolve()
N = int(input())
prev = (0,0)
prev_t = 0
for i in range(N):
    t,x,y= map(int, input().split())
    manhattan = abs(prev[0]-x) + abs(prev[1]-y)
    if manhattan%2 != (t-prev_t)%2:
        print("No")
        exit()
    if manhattan > (t-prev_t):
        print("No")
        exit()
    prev = (x,y)
    prev_t = t
print("Yes")
n = int(input())
p = [[0,0,0]]
for i in range(n):
    p.append([int(k) for k in input().split()])
res = 'No'

for i in range(1, n+1):
    t = p[i][0] - p[i-1][0]
    d = p[i][1] - p[i-1][1] + p[i][2] - p[i-1][2]
    if t % 2 == d % 2 and t >= d:
        continue
    break
else:
    res = 'Yes'

print(res)
N = int(input())
for _ in range(N):
    t, x, y = map(int, input().split())
    if x + y > t or (t + x + y)%2 != 0:
        print("No")
        quit()
print("Yes")
n = int(input())
t, x, y = 0, 0, 0
t1, x1, y1 = 0, 0, 0
p = False
for i in range(n):
	t, x, y = t1, x1, y1
	t1, x1, y1 = map(int, input().split())
	s = t1 - t
	d = x1 + y1 - x - y
	p = x >= 0 and y >= 0 and (abs(s) >= abs(d)) and ((s - d) % 2 == 0)
	# print("{},{}".format(s, d))
	if p == False:
		break
print("Yes" if p else "No")
N = int(input())

tmp_x = 0
tmp_y = 0
tmp_t = 0

for i in range(N):
  t, x, y = map(int, input().split())
  T = t - tmp_t
  d = (x - tmp_x) + (y - tmp_y)
  
  if T < d:
    print('No')
    break
  elif T % 2 == 0 and d % 2 == 1:
    print('No')
    break
  elif T % 2 == 1 and d % 2 == 0:
    print('No')
    break
    
else:
  print('Yes')
n = int(input())
lt = 0
lx = 0
ly = 0
for i in range(n):
    t, x, y = [int(i) for i in input().split()]
    dt = abs(lt-t)
    dx = abs(lx-x)
    dy = abs(ly-y)
    if not(dt >= dx + dy and dt % 2 == (dx + dy) % 2):
        print("No")
        exit()
    lt = t
    lx = x
    ly = y
print("Yes")
from collections import deque
n = int(input())

txy = deque([list(map(int, input().split())) for _ in range(n)])

tn, xn, yn = 0, 0, 0
while txy:
    t, x, y = txy.popleft()
    if (abs(xn-x)+abs(yn-y)<=(t-tn)) and (abs(xn-x)+abs(yn-y))%2==(t-tn)%2:
        tn, xn, yn = t, x, y
    else:
        print('No')
        exit()
print('Yes')
n = int(input())
for i in range(n):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t) % 2:
    print("No")
    exit()
print("Yes")
n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]

tmp = [0, 0, 0]
for t, x, y in txy:
    tmp1 = t - tmp[0]
    tmp2 = abs(x - tmp[1]) + abs(y - tmp[2])
    if tmp1 >= tmp2 and (tmp1 + tmp2) % 2 == 0:
        tmp = [t, x, y]
    else:
        print("No")
        exit()
print("Yes")
def dist(x,y):
    return abs(x[0]-y[0])+abs(x[1]-y[1])
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
X.insert(0,[0,0,0])
flag = 0
for i in range(1,N+1):
    dx = dist(X[i][1:],X[i-1][1:])
    dt = X[i][0]-X[i-1][0]
    if dt>=dx and (dt-dx)%2==0:
        continue
    else:
        flag = 1
        break
if flag==0:
    print("Yes")
else:
    print("No")
n = int(input())

t_now = 0
x_now = 0
y_now = 0

for _ in range(n):
    t,x,y = map(int,input().split())
    dist = x+y - (x_now + y_now)
    time = t - t_now
    if dist<=time and (time-dist)%2 == 0:
        t_now,x_now,y_now = t,x,y
        continue
    else:
        print('No')
        break
else:
    print('Yes')
N = int(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] = map(int, input().split())
for i in range(N):
    dt = t[i + 1] - t[i]
    dst = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
    if (dt < dst) or (dt % 2 != dst % 2):
        print("No")
        break
else:
    print("Yes")
n = int(input())
flg = 0
for i in range(n):
	t,x,y = map(int, input().split())
	if x+y > t:
		print ("No")
		exit()
	if x+y < t:
		if (x+y)%2 != t%2:
			print ("No")
			exit()
print ("Yes")
N = int(input())
now_t, now_x, now_y = 0, 0, 0

for _ in range(N):
  t, x, y = list(map(int, input().split()))
  distance = abs(now_x - x) + abs(now_y - y)
  has_time = t - now_t
  if (distance - has_time) > 0 or (distance - has_time) % 2:
    print("No")
    break
  now_t, now_x, now_y = t, x, y
else:
  print("Yes")
n=int(input())
t=[0]
x=[0]
y=[0]
for i in range(n):
    ti,xi,yi=map(int,input().split())
    t.append(ti)
    x.append(xi)
    y.append(yi)

can = True
for i in range(n):
    dt=t[i+1]-t[i]
    dist=(x[i+1]-x[i])+(y[i+1]-y[i])
    if(dt<dist):
        can=False
    if(dist%2 != dt%2):
        can=False
if(can):
    print('Yes')
else:
    print('No')
N=int(input())
T,X,Y=0,0,0
for i in range(N):
  t,x,y=map(int,input().split())
  if abs(X-x)+abs(Y-y)>t-T or t%2!=(x+y)%2:
    print("No")
    exit()
  T,X,Y=t,x,y
print("Yes")
N = int(input())
T = []
XY = []


def f(x1, y1, x2, y2):
    return abs(x1 - x2) + abs(y1 - y2)


cx, cy = 0, 0
ct = 0
for _ in range(N):
    t, x, y = map(int, input().split())
    d = f(cx, cy, x, y)
    # print(f'{ct=}, {t=}, {d=}')
    if d > t - ct:
        print('No')
        exit()
    if (t - ct - d) % 2 != 0:
        print('No')
        exit()
    cx, cy = x, y
    ct = t
print('Yes')
N=int(input())
t_list=[0]
x_list=[0]
y_list=[0]
ans="Yes"
for i in range(N):
    t,x,y=map(int,input().split())
    t_list.append(t)
    x_list.append(x)
    y_list.append(y)
for i in range(N):
    T=t_list[i+1]-t_list[i]
    X=x_list[i+1]-x_list[i]
    Y=y_list[i+1]-y_list[i]
    X=abs(X)
    Y=abs(Y)
    if T<X+Y or T%2!=(X+Y)%2:
        ans="No"
print(ans)
import sys
readline=sys.stdin.readline
read=sys.stdin.read
n,*abc=map(int,read().split())

abc=[(t,x,y) for t,x,y in zip(*[iter(abc)]*3)]
abc=[(0,0,0)]+abc
diff=[abs(nxt[2]-cur[2])+abs(nxt[1]-cur[1])-nxt[0]+cur[0] for cur,nxt in zip(abc,abc[1:])]
for d in diff:
  if d>0 or d%2==1:
    print('No')
    break
else:
  print('Yes')
import sys

input = sys.stdin.readline


N = int(input())
pt, px, py = 0, 0, 0
for i in range(N):
    t, x, y = map(int, input().split())
    d = abs(x - px) + abs(y - py)
    # print(t, d)
    if t - pt < d or (t - pt - d) % 2 != 0:
        print("No")
        sys.exit()
    pt = t
    px = x
    py = y
print("Yes")
n = int(input())
grid = [[0,0,0]] + [list(map(int,input().split())) for i in range(n)]

for i in range(1,n+1):
    dt = grid[i][0] - grid[i-1][0]
    dx = abs(grid[i][1] - grid[i-1][1])
    dy = abs(grid[i][2] - grid[i-1][2])
    #print(dt,dx,dy)
    if dt < dx + dy:
        print('No')
        break
    elif (dt - dx - dy) % 2 == 1:
        print('No')
        break
else:
    print('Yes')
import sys

input = sys.stdin.readline
t, x, y = 0, 0, 0
for _ in range(int(input())):
    t1, x1, y1 = map(int, input().split())
    a = abs(x1 - x) + abs(y1 - y)
    b = t1 - t
    if a <= b and a % 2 == b % 2:
        t, x, y = t1, x1, y1
    else:
        print("No")
        break
else:
    print("Yes")
N = int(input())

ans = True
preT,preX,preY = 0,0,0
for i in range(N):
    t,x,y = map(int,input().split())

    if abs(x-preX)+abs(y-preY) > t - preT:
        ans=False
    if (-abs(x-preX)-abs(y-preY) + t - preT)%2==1:
        ans=False
    
    preX = x
    preY = y
    preT = t

print("Yes" if ans else "No")
n=int(input())
x=[0,0,0]
ans="Yes"
for i in range(n):
  y=x
  x=list(map(int,input().split()))
  if x[0]-y[0]<abs(y[1]-x[1])+abs(y[2]-x[2]) or (x[1]+x[2])%2!=x[0]%2:
    ans="No"
    break
print(ans)
n = int(input())
p_t, p_x, p_y = 0, 0, 0

available = True

for i in range(n) :
	t, x, y = map(int, input().split())
	judge = (t - p_t) - ( abs(x - p_x) + abs(y - p_y) )
	if judge < 0 or judge % 2 != 0 :
		available = False
		break
	p_t, p_x, p_y = t, x, y

if available :
	print('Yes')
else :
	print('No')
N=int(input())

t_,x_,y_=(0,0,0)

ans = 'Yes'
for n in range(N):
    t,x,y = list(map(int,input().split()))
    T = t-t_
    manhattan_dist = abs(x-x_)+abs(y-y_)
#     print(T,manhattan_dist)
    if T >= manhattan_dist and manhattan_dist%2 == T%2:
        pass
    else:
        ans='No'
        
    t_,x_,y_ = t,x,y

print(ans)
def is_ok(a, b):
    d = abs(b[1]- a[1]) + abs(b[2] - a[2]) - (b[0] - a[0])
    if d <= 0 and d % 2 == 0:
        return True
    else:
        return False

N = int(input())
L = [[] for i in range(N + 1)]

L[0] = [0, 0, 0]
for i in range(1, N + 1):
    L[i] = list(map(int, input().split()))

ans = 'Yes'
for i in range(N):
    if not is_ok(L[i], L[i + 1]):
        ans = 'No'
        # print(i)

print(ans)
import sys

N = int(input())
arr = [list(map(int,input().split())) for i in range(N)]

for i in range(len(arr)):
    if arr[i][0] < arr[i][1]+arr[i][2] or arr[i][0]%2 != (arr[i][1]+arr[i][2])%2:
        print("No")
        exit()

for i in range(len(arr)-1):
    if arr[i+1][0]-arr[i][0] < abs(arr[i+1][1]-arr[i][1])+abs(arr[i+1][2]-arr[i][2]):
        print("No")
        exit()

print("Yes")
# -*- coding: utf-8 -*-
import math

lastT, lastX, lastY = 0, 0, 0
flag = "Yes"

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

    # print( math.fabs(t - lastT) + math.fabs(t - lastT) )

    if ( t - lastT < math.fabs(x - lastX) + math.fabs(y - lastY)
        or ( (t - lastT) - math.fabs(x - lastX) - math.fabs(y - lastY) ) % 2 == 1 ):
        flag = "No"

    lastT = t
    lastX = x
    lastY = y

print(flag)
import sys

N = int(input())

t = [0]
x = [0]
y = [0]

for i in range(N) : 
    a, b, c = map(int,input().split())
    t.append(a)
    x.append(b)
    y.append(c)

for i in range(N) : 
    T = t[i+1] - t[i]
    R = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]) 
    if T < R or (T + R) % 2 == 1 :
        print('No')
        sys.exit()

print('Yes')
N = int(input())
now_x, now_y = 0, 0
time = 0
for i in range(N):
  t, x, y = map(int, input().split())
  board = abs(x - now_x) + abs(y - now_y)
  if board > t - time:
    print("No")
    quit()
  elif ((t - time) - board) % 2 == 1:
    print("No")
    quit()
  else:
    now_x, now_y, time = x, y, t
    
print("Yes")
N = int(input())

# 現時点でのパラメータ
pt = 0
px = 0
py = 0

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

    time = abs(t - pt)
    # いわゆるマンハッタン距離
    dist = abs(x - px) + abs(y - py)

    if dist > time:
        print("No")
        exit()

    # x+yの偶奇は毎秒変わる
    # timeとdistの偶奇は一致する
    if time % 2 != dist % 2:
        print("No")
        exit()

    pt, px, py = t, x, y

print("Yes")
N = int(input())

plan = []

Feasible = True

for i in range(N):
  t,x,y = map(int,input().split())
  plan.append([t,x,y])

t0,x0,y0 = 0,0,0

for t1,x1,y1 in plan:
  dx = x1-x0
  dy = y1-y0
  dt = t1-t0
  dist = abs(dx)+abs(dy)
  d = dt - dist
  
  if dt < dist:
    Feasible = False
  elif (dist+dt)%2 != 0:
    Feasible = False
  t0,x0,y0 = t1,x1,y1
print("Yes" if Feasible else "No")
n = int(input())
list_A = [ list(map(int,input().split(" "))) for i in range(n)]
list_A.insert(0, [0, 0, 0])
ans = "Yes"
for i in range(1, n+1):
    l = list_A[i]
    k = list_A[i-1]
    distance = abs(l[1]-k[1]) + abs(l[2]-k[2])
    if distance > l[0] - k[0]:
        ans = "No"
        break
    else:
        if (distance - (l[0]-k[0])) % 2 == 1:
            ans = "No"

print(ans)
import sys
import numpy as np

read = sys.stdin.read


def main():
    N, *txy = map(int, read().split())
    t = np.array([0] + txy[::3], np.int64)
    x = np.array([0] + txy[1::3], np.int64)
    y = np.array([0] + txy[2::3], np.int64)
    time = t[1:] - t[:-1]
    length = np.abs(y[1:] - y[:-1]) + np.abs(x[1:] - x[:-1])
    if np.any((time < length) | (time % 2 != length % 2)):
        print('No')
    else:
        print('Yes')


if __name__ == '__main__':
    main()
N=int(input())
P=[(0,0,0)]
for i in range(N):
	t,x,y=map(int,input().split())
	P.append((t,x,y))

T=[0]*N
dist=[0]*N

for i in range(N):
	T[i]=P[i+1][0]-P[i][0]
	dist[i]=abs(P[i+1][1]-P[i][1])+abs(P[i+1][2]-P[i][2])

ans=1
for i in range(N):
	if dist[i]>T[i]:
		ans=0
	else:
		m=T[i]-dist[i]
		if m%2==0:
			pass
		else:
			ans=0
	if ans==0:
		break
print("Yes" if ans==1 else "No")
n=int(input())

t=[]
x=[]
y=[]

for i in range(n):
    a,b,c=map(int,input().split())
    t.append(a)
    x.append(b)
    y.append(c)
for i in range(n):
    if x[i]+y[i]>t[i] or (x[i]+y[i])%2!=t[i]%2:
        print("No")
        exit()

print("Yes")
N=int(input())
T=[list(map(int,input().split())) for _ in range(N)]

T.insert(0,[0,0,0])

ans='Yes'
for i in range(1,N+1):
    if T[i][0]-T[i-1][0]<abs(T[i][1]-T[i-1][1])+abs(T[i][2]-T[i-1][2]):
        ans='No'
    
for j in range(1,N+1):
    if (T[j][1]+T[j][2])%2!=T[j][0]%2:
        ans='No'

print(ans)
N = int(input())
a = []
for i in range(N):
  a.append(map(int,input().split()))
pt,px,py=0,0,0
for t,x,y in a:
  dt,dx,dy = t-pt,x-px,y-py
  if dt < abs(dx)+abs(dy):
    print("No")
    exit()
  if dt%2 != (abs(dx)+abs(dy))%2:
    print("No")
    exit()
  pt,px,py = t,x,y
print("Yes")
import sys

N = int(input())
now = [0]*3
for i in range(N):
    a, b, c = map(int, input().split())
    val0 = a-now[0]
    val1 = abs(b-now[1]) + abs(c-now[2])
    
    while val1 < val0:
        val1 += 2
    if val1 != val0:
        print('No')
        sys.exit()
    now = [a, b, c]
print('Yes')
n = int(input())

s = 0
p = 0
for _ in range(n):
  t,x,y = map(int, input().split())
  s = t - s
  p = abs((x+y)-p)
  if s < p:
    print("No")
    exit()
  elif s%2 != p%2:
    print("No")
    exit()
print("Yes")
n = int(input())
pt = 0
px = 0
py = 0
tmp = []
can = True

for i in range(n):
    tmp = list(map(int, input().split()))
    t = tmp[0]
    x = tmp[1]
    y = tmp[2]
    dist = abs(x-px) + abs(y-py)
    if dist > t-pt or (px+py+t-pt)%2 != (x+y)%2:
        can = False
        break

if can:
    print("Yes")
else:
    print("No")
n = int(input())
points = []
for i in range(n):
    points.append(list(map(int, input().split(" "))))

t_pre, x_pre, y_pre = 0, 0, 0
reachable = True
for point in points:
    t, x, y = map(int, point)
    diff_t = t - t_pre
    p = x + y
    p_pre = x_pre + y_pre
    move = 0
    for _ in range(diff_t):
        move += 1 if p > (p_pre + move) else -1

    if p - p_pre != move:
        reachable = False
        break

    t_pre, x_pre, y_pre = t, x, y

print("Yes" if reachable == True else "No")
N=int(input())
dx,dy,dt=0,0,0
count=0
for i in range(N):
    t,x,y=map(int,input().split())
    if (x+y+t)%2 == 0 and abs(x-dx) + abs(y-dy) <= abs(t-dt):
        count+=1
    dx,dy,dt=x,y,t

if count==N:
    print("Yes")
else:
    print("No")
N = int(input())

ans = "Yes"
i = 0

while i < N:
  t,x,y = [ int(num) for num in input().split() ]
  
  if x+y <= t and (t-x-y)%2 == 0:
    i += 1
  else:
    ans = "No"
    break

print(ans)
n = int(input())
t_ = 0
x_ = 0
y_ = 0
for i in range(n):
    t, x, y = 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')
N = int(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] = map(int, input().split())

f = True
for i in range(N):
    dt = t[i+1] - t[i]
    dictlist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
    
    if dt < dictlist:
        f = False
    if dictlist % 2 != dt % 2:
        f = False

print("Yes" if f else "No")
#2パターンでのfail
#①→偶奇がstepと位置で違う
#単純に遠すぎる
n = int(input())

t_pre =0
x_pre =0
y_pre =0
for i in range(n):
    t,x,y = list(map(int,input().split()))
    if (t-t_pre)<abs(x-x_pre)+abs(y-y_pre):
        print('No')
        break
    if t%2 != (x+y)%2:
        print('No')
        break
    t_pre = t
    x_pre =x
    y_pre = y
    
    if i ==n-1:
        print('Yes')
import sys
import numpy as np

n = int(sys.stdin.readline().rstrip())
txy = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(n, 3)
t, x, y = np.concatenate((np.array([[0, 0, 0]]), txy), axis=0).T

def main():
    dt = t[1:] - t[:-1]
    dd = np.absolute(x[1:] - x[:-1]) + np.absolute(y[1:] - y[:-1])
    ans = 'Yes' if np.all((dt >= dd) & (dt & 1 == dd & 1)) else 'No'
    print(ans) 

if __name__ ==  '__main__':
    main()
N=int(input())+1
t,x,y,r=[0]*N,[0]*N,[0]*N,1
N-=1
for i in range(N):
    i+=1
    t[i],x[i],y[i]=map(int,input().split())

def a(t,x,y):
    return (x+y<=t)*(1-(x+y-t)%2)

for i in range(N):
    r*=a(t[i+1]-t[i],abs(x[i+1]-x[i]),abs(y[i+1]-y[i]))
print(['No','Yes'][r])
n = int(input())
t_x_y_list = [list(map(int, input().split())) for _ in range(n)]
pt = 0
px = 0
py = 0
for t, x, y in t_x_y_list:
    if t - pt < abs(px - x) + abs(py - y):
        print("No")
        exit()
    if (t - pt) % 2 != (abs(px - x) + abs(py - y)) % 2:
        print("No")
        exit()
    pt = t
    px = x
    py = y
print("Yes")
n = int(input())
x, y = 0, 0
t = 0
for i in range(n):
    ti, xi, yi = map(int, input().split())
    l = abs(xi - x + yi - y)
    if l <= ti - t and l % 2 == (ti - t) % 2:
        x, y = xi, yi
        t = ti
    else:
        print("No")
        break
else:
    print("Yes")
n = int(input())
t=[0]
x=[0]
y=[0]
for i in range(n):
    _t, _x, _y = map(int, input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

flag = 0
for i in range(1,n+1):
    dt = t[i] - t[i-1]
    dx = x[i] - x[i-1]
    dy = y[i] - y[i-1]
    dist = abs(dx) + abs(dy)
    if dist > dt:
        flag = flag +1
    elif dist % 2 != dt % 2:
        flag = flag +1
else:
    print("Yes" if flag ==0 else "No")
def main():
  N = int(input())
  A = [[int(_) for _ in input().split()] for __ in range(N)]
  t0 = x0 = y0 = 0
  for a in A:
    t, x, y = a
    if (t - t0 < abs(x - x0) + abs(y - y0)) or (t%2 == 0 and (x + y)%2 == 1) or (t%2 == 1 and (x + y)%2 == 0):
      print('No')
      break
    t0, x0, y0 = t, x, y
  else:
    print('Yes')
  return

if __name__ == '__main__':
  main()