Problem:
 Score : 300 points    Problem Statement AtCoDeer the deer is going on a trip in a two-dimensional plane.
In his plan, he will depart from point (0, 0) at time 0 , then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i .  If AtCoDeer is at point (x, y) at time t , he can be at one of the following points at time t+1 : (x+1,y) , (x-1,y) , (x,y+1) and (x,y-1) .
Note that he cannot stay at his place .
Determine whether he can carry out his plan.      Constraints  1  ≤  N  ≤  10^5  0  ≤  x_i  ≤  10^5  0  ≤  y_i  ≤  10^5  1  ≤  t_i  ≤  10^5  t_i  <  t_{i+1} ( 1  ≤  i  ≤  N-1 )  All input values are integers.         Input Input is given from Standard Input in the following format:  N  t_1  x_1  y_1  t_2  x_2  y_2  :  t_N  x_N  y_N       Output If AtCoDeer can carry out his plan, print Yes ; if he cannot, print No .        Sample Input 1 2
3 1 2
6 1 1      Sample Output 1 Yes  For example, he can travel as follows: (0,0) , (0,1) , (1,1) , (1,2) , (1,1) , (1,0) , then (1,1) .       Sample Input 2 1
2 100 100      Sample Output 2 No  It is impossible to be at (100,100) two seconds after being at (0,0) .       Sample Input 3 2
5 1 1
100 1 1      Sample Output 3 No

Solution (Python):
n = int(input())
t_1 ,x_1 ,y_1 = 0,0,0
f = 1

for i in range(n):
    t_2 ,x_2 ,y_2 = map(int,input().split())
    x = ((t_2 - t_1) - abs(x_1 - x_2) - abs(y_1 - y_2))
    if  x % 2 == 0 and x >= 0:
        t_1 ,x_1 ,y_1 = t_2 ,x_2 ,y_2
    else:
        f = 0
        print("No")
        break
if f:
    print("Yes")

Solution (Python):

N = int(input())


ans = 'Yes'
for i in range(N):
	t, x, y = map(int, input().split())
	if t < x + y or t%2 != (x+y)%2:
		ans = 'No'


print(ans)

Solution (Python):
import numpy as np

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

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


lst_bool = []
for i in range(N):
  dt = X[i+1][0] - X[i][0]
  dx = X[i+1][1] - X[i][1]
  dy = X[i+1][2] - X[i][2]
  dl = abs(dx) + abs(dy)
  bool_1 = (dt >= dl)
  bool_2 = ((dt - dl) % 2 == 0)
  lst_bool.append(bool_1 and bool_2)

if all(lst_bool):
  print('Yes')
else:
  print('No')

Solution (Python):
def difference(two_lists):
    return [abs(two_lists[1][i] - two_lists[0][i]) for i in range(3)]


n = int(input())

txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]
dtxy = list(map(difference, zip(txy, txy[1:])))

for i in range(n):
    dt, dx, dy = dtxy[i]
    if  dx + dy > dt or (dt - dx - dy) % 2:
        print("No")
        exit()
print("Yes")

Solution (Python):
n = int(input())

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

Solution (Python):
N = int(input())
t0,x0,y0=0,0,0
for i in range(N):
  t,x,y = list(map(int, input().strip().split(' ')))
  l=x+y-x0-y0
  if (t0-t)%2 ^ l%2:print("No");exit()
  if t-t0<l:print("No");exit()
  t0,x0,y0=t,x,y
print("Yes")

Solution (Python):
N = int(input())
t,x,y = 0,0,0

for i in range(N):
	T,X,Y = map(int,input().split())
	t_res = (T-t)
	xy_res = abs(X-x)+abs(Y-y)
	if (t_res - xy_res) % 2 == 0 and t_res >= xy_res:
		ans = 'Yes'
		t,x,y = T,X,Y
	else:
		ans = 'No'
		for j in range(N-(i+1)):
			input()
		break
print(ans)

Solution (Python):
N=int(input())
nt=0
np=(0,0)
ok=True
for t,x,y in [map(int,input().split()) for _ in range(N)]:
  el,nt=t-nt,t
  dist=abs(np[0]-x)+abs(np[1]-y)
  
  if el<dist: 
    ok=False 
    break
  if (el-dist)%2!=0:
    ok=False 
    break
  np=(x,y)
if ok:
  print("Yes")
else:
  print("No")

Solution (Python):
N=int(input())
count=0
for i in range(N):
    t,x,y=map(int,input().split())
    if x+y<=t and t%2==(x+y)%2:count+=1
print("Yes" if count==N else "No")

Solution (Python):
n = int(input())

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

Solution (Python):
def difference(two_lists):
    return [abs(two_lists[1][i] - two_lists[0][i]) for i in range(3)]


n = int(input())

txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]
dtxy = list(map(difference, zip(txy, txy[1:])))

for i in range(n):
    dt, dx, dy = dtxy[i]
    if  dx + dy > dt or (dt - dx - dy) % 2:
        print("No")
        exit()
print("Yes")

Solution (Python):
n = int(input())

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

for i in range(n):
    t, x, y = txy[i]
    if  x + y > t or (t - x - y) % 2:
        print("No")
        exit()
print("Yes")

Solution (Python):
N=int(input())
txy=[list(map(int,input().split())) for i in range(N)]
ans=0
for i in range(N):
    t,x,y=txy[i][0],txy[i][1],txy[i][2]
    if x+y<=t and t%2==(x+y)%2:ans+=1
print("Yes" if ans==N else "No")

Solution (Python):
N=int(input())
txy=[list(map(int,input().split())) for i in range(N)]
ans=0
for i in range(N):
    t,x,y=txy[i][0],txy[i][1],txy[i][2]
    if x+y<=t and t%2==(x+y)%2:ans+=1
print("Yes" if ans==N else "No")

Solution (Python):
n = int(input())
t, x, y = 0, 0, 0
for i in range(n):
    ti, xi, yi = map(int, input().split())
    dt = ti - t
    dx = abs(xi - x)
    dy = abs(yi - y)
    if dt >= dx + dy and dt % 2 == (dx + dy) % 2:
        t, x, y = ti, xi, yi
        continue
    print('No')
    break
else:
    print('Yes')

Solution (Python):
n = int(input())
ans = True
t = x = y = 0
for i in range(n):
    t1,x1,y1 = map(int,input().split())
    num = abs(x1-x) + abs(y1-y)
    tdif = abs(t1-t)
    if num <= tdif and (num-tdif) % 2 == 0:
        pass
    else:
        ans = False
if ans:
    print('Yes')
else:
    print('No')

Solution (Python):
N=int(input())
t=[0]*N
x=[0]*N
y=[0]*N
for i in range(N):
  t[i],x[i],y[i]=map(int,input().split())
  
def traveling(t,x,y):
  time_i=0
  x_i=0
  y_i=0
  for i,time in enumerate(t):
    time_i=time-time_i
    x_i=x[i]-x_i
    y_i=y[i]-y_i
    z=x_i+y_i
    if (time_i-z)%2!=0 or z>time_i:
      return "No"
    time_i=time
    x_i=x[i]
    y_i=y[i]
  return "Yes"
    
print("{}".format(traveling(t,x,y)))

Solution (Python):
N = int(input())
manhat = lambda x,y:abs(x[0]-y[0])+abs(x[1]-y[1])
flag = True
t_,x_,y_ = 0,0,0
for i in range(N):
  t,x,y = map(int, input().split())
  dt = t-t_
  dx = manhat((x,y), (x_,y_))
  if dt < dx or (dt - dx) % 2:
    flag = False
    break
  t_,x_,y_ = t,x,y

print('Yes' if flag else 'No')

Solution (Python):
N = int(input())

t,x,y = [0] * (N+1), [0] * (N+1), [0] * (N+1)
for i in range(1,N+1):
    t[i], x[i], y[i] = map(int, input().split())

can = "Yes"
for j in range(N):
    dt = t[j+1] - t[j]
    dr = abs(x[j+1]-x[j]) + abs(y[j+1] - y[j])

    if (dt < dr) | (dr % 2 != dt % 2):
        can = "No"
        break
    
print(can)

Solution (Python):
N = int(input())  
Plan = [list(map(int, input().split())) for i in range(N)]  



def checkCel(x, y):
    if x % 2 == 0:
        if y % 2 == 0:  
            return "Black"
        else:  
            return "White"

    else:
        if y % 2 == 0:  
            return "White"
        else:  
            return "Black"


OKNG = 'Yes'
x, y = Plan[0][1], Plan[0][2]
remain = Plan[0][0]

for i in range(0, len(Plan)):

    
    if x + y < remain + 1:

        
        cel = checkCel(x, y)

        
        if not ((remain % 2 == 0 and cel == "Black") or \
                (remain % 2 == 1 and cel == "White")):
            OKNG = 'No'
    else:
        OKNG = 'No'

    if i < len(Plan) - 1:
        remain = Plan[i + 1][0] - remain
        x = Plan[i + 1][1] - x
        y = Plan[i + 1][2] - y

print(OKNG)

Solution (Python):


import numpy as np

n=int(input())
l=np.array([0,0,0])
d=l
rest="Yes"

for _  in range(n):
	t=np.array(list(map(int,input().split())))
	t2=t-d
	if t2[0]-t2[1]-t2[2] >=0 and (t2[0]-t2[1]-t2[2])%2 ==0:
		d=t2
	else:
		rest="No"

print(rest)

Solution (Python):
n=int(input())
tn,xn,yn=0,0,0
for _ in range(n):
    ti,xi,yi=map(int,input().split())
    td,xd,yd=ti-tn,xi-xn,yi-yn
    if td<xd+yd or (td+xd+yd)%2!=0:
        print('No')
        exit()
    tn,xn,yn=ti,xi,yi
print('Yes')

Solution (Python):
N = int(input())
TXY = [tuple(map(int, input().split())) for _ in range(N)]

lt, lx, ly = 0, 0, 0
for t, x, y in TXY:
	difft = t - lt
	diffp = abs(x - lx) + abs(y - ly)
	if difft < diffp or (diffp - difft) % 2:
		print("No")
		break
	lt, lx, ly = t, x, y
else:
	print("Yes")

Solution (Python):
n=int(input())
nt,nx,ny=0,0,0
for i in range(n):
    t,tx,ty=map(int,input().split())
    dis=abs(tx-nx)+abs(ty-ny)
    tm=t-nt
    if dis>tm or dis%2!=tm%2:
        print("No")
        exit()
    nt,nx,ny=t,tx,ty
print("Yes")

Solution (Python):
import sys
n=int(input())
nt,nx,ny=0,0,0
for i in range(n):
    t,tx,ty=map(int,input().split())
    dis=abs(tx-nx)+abs(ty-ny)
    if dis>(t-nt):
        print("No")
        sys.exit()
    if dis%2!=(t-nt)%2:
        print("No")
        sys.exit()
    nt,nx,ny=t,tx,ty
print("Yes")

Solution (Python):
N = int(input())
pos = [list(map(int,input().split())) for _ in range(N)]
posx = 0
posy = 0
disx = 0
disy = 0
dis  = 0
time = 0
for n in range(N):
    disx = abs(pos[n][1]-posx)
    disy = abs(pos[n][2]-posy)
    dis = disx + disy
    if((pos[n][0]-time)-dis)<0:
        print("No")
        exit()
    else:
        if ((pos[n][0]-time)-dis)%2!=0:
            print("No")
            exit()
        else:
            time = pos[n][0]
            posx = pos[n][1]
            posy = pos[n][2]
print("Yes")

Solution (Python):
N = int(input())
A = [[0, 0, 0]] + [[int(i) for i in input().split()] for _ in range(N)]

for (t, x, y), (nt, nx, ny) in zip(A[:N], A[1:]):
    d = abs(x - nx) + abs(y - ny)
    r = nt - t
    if d > r or d % 2 != r % 2:
        print("No")
        quit()
print("Yes")

Solution (Python):
N = int(input())
t = [[0,0,0]]+[[int(x) for x in input().split()] for _ in range(N)]
flag = True

for ind,i in enumerate(t[1:]):
    dist = i[0]-t[ind][0]-(sum(i[1:])-sum(t[ind][1:]))
    if(dist==0):
        pass
    elif(dist>0):
        if(dist%2==0):
            pass
        elif(i[1]!=t[ind][1] and i[2]!=t[ind][2] and dist>1):
            pass
        else:
            flag = False
            break
    else:
        flag = False
        break
if(flag):
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(input())
ans=0
time_now=0
x_now=0
y_now=0
for i in range(n):
  time,x,y=map(int,input().split())
  jikan=time-time_now
  kyori=abs(x-x_now)+abs(y-y_now)
  if(jikan>=kyori and jikan%2==kyori%2):
    ans+=0
  else:
    ans+=1
  time_now=time
  x_now=x
  y_now=y
  
if(ans==0):
  print("Yes")
else:
  print("No")

Solution (Python):
import sys
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)

for i in range(N):
    diff_T = T[i+1] - T[i]
    diff_X = abs(X[i+1] - X[i])
    diff_Y = abs(Y[i+1] - Y[i])
    if diff_T < diff_X + diff_Y:
        print('No')
        sys.exit()
    if (diff_X + diff_Y - diff_T) % 2:
        print('No')
        sys.exit()
        
print('Yes')

Solution (Python):
n=int(input())
a= [list(map(int, input().split())) for i in range(n)]
t,x,y=0,0,0
for i in a:
    e=i[0]-t
    l=abs(x-i[1])+abs(y-i[2])
    t,x,y=i
    if(e>=l and (e-l)%2==0):
        continue
    else:
        print("No")
        break
else:
    print("Yes")

Solution (Python):
n = int(input())
previous_t = 0
ans = "Yes"
for i in range(n):
    t, x, y = list(map(int, input().split()))
    if x + y > t:
        ans = "No"
        break
    if (x + y) % 2 != t % 2:
        ans = "No"
        break
    if previous_t > 0 and (abs(x - previous_x) + abs(y - previous_y) > (t - previous_t)):
        ans = "No"
        break
    previous_t = t
    previous_x = x
    previous_y = y

print(ans)

Solution (Python):
n = int(input())
previous_t = 0
for i in range(n):
    t, x, y = list(map(int, input().split()))
    if x + y > t:
        print("No")
        break
    if (x + y) % 2 != t % 2:
        print("No")
        break
    if previous_t > 0 and (abs(x - previous_x) + abs(y - previous_y) > (t - previous_t)):
        print("No")
        break
    previous_t = t
    previous_x = x
    previous_y = y
else:
    print("Yes")

Solution (Python):

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

Solution (Python):

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

Solution (Python):
N = int(input())
count = 0
for i in range(N):
    K = list(map(int,input().split()))
    if K[0]>=K[1]+K[2] and K[0]%2==(K[1]+K[2])%2:
        count += 1

if count == N:
    print('Yes')
else:
    print('No')

Solution (Python):
from sys import stdin

n = int(stdin.readline())
for i in range(n):
    t, x, y = map(int, stdin.readline().split())
    dist = x + y
    if t < dist or (dist % 2) != (t % 2):
        print("No")
        exit()

print("Yes")

Solution (Python):
n = int(input())
li = [list(map(int,input().split())) for i in range(n)]
 
if li[0][0] - abs(li[0][1]) - abs(li[0][2]) < 0:
  print("No")
  exit()
elif li[0][0] - abs(li[0][1]) - abs(li[0][2]) > 0:
  if (li[0][0] - abs(li[0][1]) - abs(li[0][2])) % 2 != 0:
    print("No")
    exit()
else:
  for k in range(1,n):
    t = li[k][0]
    x = li[k][1]
    y = li[k][2]
    tt = li[k-1][0]
    xx = li[k-1][1]
    yy = li[k-1][2]
    if t - tt - abs(x - xx) - abs(y - yy) <0:
      print("No")
      exit()
    elif t - tt - abs(x - xx) - abs(y - yy) <0:
      if (t - tt - abs(x - xx) - abs(y - yy)) % 2 != 0:
        print("No")
        exit()
print("Yes")

Solution (Python):



n = int(input())
ret = "Yes"
for i in range(n):
    t, x, y = map(int, input().split())
    if x + y > t:
        ret = "No"
        break
    if t % 2 == 0 and (x + y) % 2 == 1:
        ret = "No"
        break
    elif t % 2 == 1 and (x + y) % 2 == 0:
        ret = "No"
        break
print(ret)

Solution (Python):



n = int(input())
ret = "Yes"
for i in range(n):
    t, x, y = map(int, input().split())
    if x + y > t:
        ret = "No"
        break
    if t % 2 == 0 and (x + y) % 2 == 1:
        ret = "No"
        break
    elif t % 2 == 1 and (x + y) % 2 == 0:
        ret = "No"
        break
print(ret)

Solution (Python):
n=int(input())
flag=1
ct,cx,cy=0,0,0
for i in range(n):
  t,x,y=map(int,input().split())
  if t-ct<abs(x-cx)+abs(y-cy) or (t+x+y)%2!=0:
    flag=0
print("Yes" if flag==1 else "No")

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    poss = []

    time = 0
    x = 0
    y = 0 
    for i in range(n):
        t,a,b = f()
        dis = abs(a-x) + abs(y-b)
        if dis<= t - time and dis%2 == (t- time)%2:
            time = t
            x = a
            y = b
        else:
            print('No')
            return
    
    print('Yes')



solve()

Solution (Python):
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")

Solution (Python):




n = int(input())


wt = 0
wx = 0
wy = 0
postra_flg = True

for i in range(n):
    t, x, y = map(int, input().split())
    et = t - wt
    dist = abs(x - wx) + abs(y - wy)
    remt = et - dist
    
    
    if remt < 0 or remt % 2 == 1:
        postra_flg = False
        break

if postra_flg == True:
    ans = "Yes"
else:
    ans = "No"


print(ans)

Solution (Python):
n = int(input())
d = [[int(i) for i in input().split()] for i in range(n)]
status = (0,0,0)
result = "Yes"
for i in d:
    dist = abs((i[1]+i[2]) - (status[1]+status[2]))
    time = i[0] - status[0]
    if (time >= dist) and (time - dist) % 2 == 0:
        status = i
    else:
        result = "No"
        break
print(result)

Solution (Python):
N=int(input())
t,x,y=[None]*(N+1),[None]*(N+1),[None]*(N+1)
t[0],x[0],y[0]=0,0,0
for i in range(1,N+1):
    t[i],x[i],y[i] = map(int,input().split())
for i in range(N):
    l = t[i+1]-t[i]
    d = abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
    if d <= l and (l-d) % 2 == 0:
        if i == N-1:
            print("Yes")
            break
    else:
        print("No")
        break

Solution (Python):
n = int(input())

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

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

Solution (Python):

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

point = [0,0,0]
output = 'Yes'
for plan in plan_list:
    dist = abs(plan[1] - point[1]) + abs(plan[2] - point[2])
    time = plan[0] - point[0]
    if time >= dist and (dist - time)%2 == 0:
        point = plan
        continue
    else:
        output = 'No'
        break

print (output)

Solution (Python):
n = int(input())
T = [0];X = [0];Y = [0]
for i in range(n):
    t, x, y = [int(i) for i in input().split()]
    T.append(t);X.append(x);Y.append(y)

for i in range(1, n+1):
    t_diff = T[i] - T[i-1]
    pos_diff = abs(X[i] - X[i-1]) + abs(Y[i] - Y[i-1])
    a = t_diff - pos_diff
    if a % 2 != 0 or a < 0:
        break
else:
    print("Yes")
    exit()
print("No")

Solution (Python):
def main():
  size = int(input())
  array = []
  for i in range(size):
    array.append(list(map(int, input().split())))
                    
  flg = "Yes"           
  pre_time = 0
  pos = [0, 0] 
  for i in range (size):
    time = array[i][0] - pre_time
    distance = abs(array[i][1]-pos[0]) + abs(array[i][2]-pos[1])
    
    if time == distance or ((distance<time) and (time-distance)%2 == 0):
      pre_time = array[i][0]
      pos = array[i][1:]
    else:
      flg = "No"
                    
  print(flg)
                    
main()

Solution (Python):


n = int(input())

t0 = x0 = y0 = 0
for i in range(n):
    t, x, y = map(int, input().split())
    dt = t - t0
    dm = abs(x - x0) + abs(y - y0)
    if dt < dm or dt % 2 != dm %2:
        print('No')
        exit()

    t0 = t
    x0 = x
    y0 = y

print('Yes')

Solution (Python):


n = int(input())

t0 = x0 = y0 = 0
for i in range(n):
    t, x, y = map(int, input().split())
    dt = t - t0
    dm = abs(x - x0) + abs(y - y0)
    if dt < dm:
        print('No')
        exit()
    elif dt % 2 != dm %2:
        print('No')
        exit()

    t0 = t
    x0 = x
    y0 = y

print('Yes')

Solution (Python):
n = int(input())
for i in range(n):
  t,x,y=map(int,input().split())
  if x + y > t:
    print("No")
    exit()
  elif (x+y+t)%2 != 0:
    print("No")
    exit()
print("Yes")

Solution (Python):
"""
可変長データの読み込み
"""
t = []
x = []
y = []

t.append(0)
x.append(0)
y.append(0)

for i in (range(0, 1000000, 1)):
  try:
    c = input()
    if i == 0:
      N = int(c)
    else:
      t.append(int(c.split(" ")[0]))
      x.append(int(c.split(" ")[1]))
      y.append(int(c.split(" ")[2]))
  except:
    break

for i in range(0, len(t) - 1, 1):
  
  con1 = t[i + 1] >= (x[i + 1] + y[i + 1]) 
  dt = t[i+1] - t[i]
  dist = (x[i+1]-x[i]) + (y[i+1] - y[i]) 

  if con1 is True and (dt - dist) %2 == 0:
    ans = "Yes"
  else:
    ans = "No"
    break
    
print(ans)

Solution (Python):
n = int(input())
x, y, t = 0, 0, 0
schd = []

for _ in range(n):
    schd.append(list(map(int, input().split())))

for k in range(n):
    t1, x1, y1 = schd[k][0], schd[k][1], schd[k][2]
    dist = abs(x1-x) + abs(y1-y)
    if dist <= t1-t and (t1-t-dist)%2 == 0:
        t, x, y = t1, x1, y1
    else:
        print("No")
        exit()
else:
    print("Yes")

Solution (Python):

n = int(input())

for i in range(n):
    t,x,y=map(int,input().split())
    if x + y > t :
        print('No')
        exit()
    elif (x + y + t) % 2 != 0 :
        print('No')
        exit()

print("Yes")

Solution (Python):
N = int(input())
P = [[0,0,0]]
for _ in range(N):
    tmp = list(map(int,input().split()))
    P.append(tmp)

for i in range(1,N+1):
    r = abs(P[i][1]-P[i-1][1])+abs(P[i][2]-P[i-1][2])
    t = P[i][0]-P[i-1][0]
    if r % 2 != t % 2 or r > t:
        print('No')
        exit()

print('Yes')

Solution (Python):


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

Solution (Python):
n = int(input())
for i in range(n):
    t,x,y = map(int, input().split())
    if (x + y) > t or (x + y + t) % 2 != 0:
        print("No")
        exit()

print("Yes")

Solution (Python):
n = int(input())
for i in range(n):
    t,x,y = map(int, input().split())
    if (x + y) > t or (x + y + t) % 2 != 0:
        print("No")
        exit()

print("Yes")

Solution (Python):
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")

Solution (Python):
n = int(input())
u,x,y = 0,0,0

for i in range(n):
    t,a,b = map(int,input().split())
    dis = abs(x-a) + abs(y-b)
    if dis%2!=(t-u)%2 or dis>t:
        print('No')
        exit()
    u,x,y = t,a,b
print('Yes')

Solution (Python):
nt,nx,ny=0,0,0
ans="Yes"
for _ in range(int(input())):
	t,x,y=map(int, input().split())
	d=abs(x-nx)+abs(y-ny)
	if t-nt < d:
		ans="No"
		break
	elif (t-nt-d) % 2 != 0:
		ans="No"
		break

print(ans)

Solution (Python):
n = int(input())
bt,bx,by=0,0,0

ans=True
for i in range(n):
    t, x, y = map(int, input().split())
    dt=t-bt
    dist=abs(x-bx)+abs(y-by)
    if dt<dist:
        ans = False
    if dist % 2 != dt % 2:
        ans=False

    bt,bx,by=t,x,y
    
if ans:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
bt,bx,by=0,0,0
ans=True
for i in range(n):
    t, x, y = map(int, input().split())
    dt=t-bt
    l=abs(x-bx)+abs(y-by)
    if dt<l:
        ans = False
    if (dt-l)%2:ans=False

    bt,bx,by=t,x,y
print('Yes' if ans else 'No')

Solution (Python):
def check(x, y, new_x, new_y, dt):
  diff = abs(new_x - x) + abs(new_y - y)
  if dt%2 == diff%2 and diff <= dt:
    return True
  return False

n = int(input())
t, x, y, count = 0, 0, 0, 0
canReach = True
while(count < n):
  new_t, new_x, new_y = map(int, input().split())
  if not check(x, y, new_x, new_y, new_t-t):
    canReach = False
    break
  t, x, y = new_t, new_x, new_y
  count += 1
if canReach:
  print("Yes")
else:
  print("No")

Solution (Python):
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")

Solution (Python):
def main():
    N = int(input())
    l = [[int(s) for s in input().split()] for n in range(N)]
    can = True
    now = [0, 0, 0]
    for i in range(N):
        pos = l[i]
        d = abs(pos[1] - now[1]) + abs(pos[2] - now[2])
        t = pos[0] - now[0]
        if d % 2 != t % 2 or d > t:
            can = False
        now = pos
    if can:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
data = []
for i in range(N):
    data.append(list(map(int, input().split())))
if N == 1:
    prob = data[0][0] - data[0][1] - data[0][2]
    if prob < 0 or prob % 2 != 0:
        print("No")
    else:
        print("Yes")
    quit()
for i in range(N-1):
    t = data[i][0]
    x = data[i][1]
    y = data[i][2]
    deltaT = data[i+1][0] - t
    absX = abs(data[i+1][1] - x)
    absY = abs(data[i+1][2] - y)
    prob = deltaT - absX - absY
    if prob < 0 or prob % 2 != 0:
        print("No")
        quit()
print("Yes")

Solution (Python):
n = int(input())
pre_t, pre_x, pre_y = [0, 0, 0]
ok = True
for i in range(n):
  t, x, y = map(int, input().split())
  d = (t-pre_t) - abs(x-pre_x) - abs(y-pre_y)
  if d < 0 or d % 2 != 0:
    ok = False
    break
  pre_t, pre_x, pre_y = [t, x, y]
  
if ok:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
pre_t, pre_x, pre_y = [0, 0, 0]
ok = True
for i in range(n):
  t, x, y = map(int, input().split())
  if (((t-pre_t) - abs(x-pre_x) - abs(y-pre_y)) < 0
      or ((t-pre_t) - abs(x-pre_x) - abs(y-pre_y)) % 2 != 0):
    ok = False
    break
  pre_t, pre_x, pre_y = [t, x, y]
  
if ok:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())

pre_t, pre_x, pre_y = [0, 0, 0]
ok = True
for i in range(n):
  t, x, y = map(int, input().split())
  if (((t-pre_t) - (abs(x-pre_x) + abs(y-pre_y))) < 0
      or ((t-pre_t) - (abs(x-pre_x) + abs(y-pre_y))) % 2 != 0):
    ok = False
    break
  pre_t, pre_x, pre_y = [t, x, y]
  
if ok:
  print("Yes")
else:
  print("No")

Solution (Python):
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)
  
ok = True
for i in range(n):
  ti = t[i+1] - t[i]
  if ((ti - (abs(x[i+1]-x[i]) + abs(y[i+1]-y[i]))) < 0
      or (ti - (abs(x[i+1]-x[i]) + abs(y[i+1]-y[i]))) % 2 != 0):
    ok = False
    break
if ok:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
TXY = [list(map(int, input().split())) for _ in range(N)]
t, x, y = 0, 0, 0
for i in range(N):
    T, X, Y = TXY[i]
    z = (T - t) - ((X - x) + (Y - y))
    if z >= 0 and z % 2 == 0:
        t, x, y = T, X, Y
    else:
        print('No')
        exit()
print('Yes')

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
TXY = [list(map(int, input().split())) for _ in range(N)]
t, x, y = 0, 0, 0
for i in range(N):
    T, X, Y = TXY[i]
    z = (T - t) - ((X - x) + (Y - y))
    if z >= 0 and z % 2 == 0:
        t, x, y = T, X, Y
    else:
        print('No')
        exit()
print('Yes')

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

Solution (Python):
n=int(input())
c=1
t=[0]*(n+1)
x=[0]*(n+1)
y=[0]*(n+1)
while c<n+1:
    a,b,d=(int(x) for x in input().split())
    t[c]=a
    x[c]=b
    y[c]=d
    c=c+1
c=1
kotae=0
while c<n+1:
    time=t[c]-t[c-1]
    kyori=x[c]-x[c-1]+y[c]-y[c-1]
    if time>=kyori:
        if time%2==kyori%2:
            kotae=1
        else:
            kotae=2
            break
    else:
        kotae=2
        break
    c=c+1
if kotae==1:
    print('Yes')
else:
    print('No')

Solution (Python):
t = []
x = []
y = []
N = int(input())
s = []
 
for i in range(N):
    t1, x1, y1 = [int(i) for i in input().split()]
    t.append(t1)
    x.append(x1)
    y.append(y1)
 
for i in range(N):
    if i == 0 and t[i] < abs(x[i]) + abs(y[i]):
        s.append(0)
    elif i > 0 and t[i] - t[i - 1] < abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]):
        s.append(0)
    else:
        if (t[i] % 2 == 1 and x[i] % 2 == 0 and y[i] % 2 == 0) or (t[i] % 2 == 1 and x[i] % 2 == 1 and y[i] % 2 == 1):
            s.append(0)
        elif (t[i] % 2 == 0 and x[i] % 2 == 1 and y[i] % 2 == 0) or (t[i] % 2 == 0 and x[i] % 2 == 0 and y[i] % 2 == 1):
            s.append(0)
        else:
            s.append(1)
 
for i in s:
    if i == 0:
        print("No")
        break
else:
    print("Yes")

Solution (Python):
N = int(input())
t = [0] * N
x = [0] * N
y = [0] * N
for i in range(N):
    t[i], x[i], y[i] = map(int, input().split())
    
if t[0] >= x[0] + y[0] and t[0] % 2 == (x[0] + y[0]) % 2:
    flag = True
else:
    flag = False

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

Solution (Python):
n=int(input())
t,x,y=map(int,input().split())
if t<x+y or (t-x-y)%2!=0:
    print("No")
    exit()
tmp_t=t
tmp_x=x
tmp_y=y
for i in range(n-1):
    t,x,y=map(int,input().split())
    if t-tmp_t<abs(tmp_x-x)+abs(tmp_y-y) or (t-tmp_t-abs(tmp_x-x)-abs(tmp_y-y))%2!=0:
        print("No")
        exit()
    else:
        tmp_t=t
        tmp_x=x
        tmp_y=y
else:
    print("Yes")

Solution (Python):
import sys

def main():
    n = int(input())
    t_, x_, y_ = 0, 0, 0
    for nn in range(n):
        t, x, y = map(int, input().split())
        diff = abs(x - x_) + abs(y - y_)
        if diff > t - t_ or (diff + t - t_) % 2:
            print('No')
            exit(0)
    print('Yes')

if __name__ == '__main__':
    main()

Solution (Python):


import sys
input = sys.stdin.readline

def io_generator():
	return input()



def main2(io):
	n=int(io())
	(t,x,y)=0,0,0
	for i in range(n):
		nt,nx,ny = map(int, io().split())
		dist = abs(x-nx) + abs(y-ny)
		duration = nt - t
		if dist > duration or dist%2 != duration%2:
			return False
		(t,x,y)=(nt,nx,ny)
	
	return True
	
def main(io):
	ret = main2(io)
	return 'Yes' if ret else 'No'



if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

Solution (Python):
N = int(input())
txy = [list(map(int,input().split())) for _ in [0]*N]
tc,xc,yc = 0,0,0
for tn,xn,yn in txy:
    d = abs(xc-xn) + abs(yc-yn)
    dt = tn - tc
    if d > dt or (d+dt)%2 == 1 :
        print("No")
        break
    tc,xc,yc = tn,xn,yn
else:
    print("Yes")

Solution (Python):
N = int(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] = map(int, input().split())
count = 0    
for j in range(1, N+1):
    if not(t[j]-t[j-1] >= abs(x[j]-x[j-1]) + abs(y[j]-y[j-1]) and (abs(x[j]-x[j-1]) + abs(y[j]-y[j-1])) % 2 == (t[j]-t[j-1]) % 2):
        print('No')
        count = 1
        break
        
if count == 0:
    print('Yes')

Solution (Python):
import sys

N = int(input())
t = [0]
x = [0]
y = [0]

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

for i in range(len(t)-1):
  T = t[i+1] - t[i]
  d = abs(x[i] - x[i+1]) + abs(y[i] - y[i+1])
  if not (d <= T and T%2 == d%2):
    print('No')
    sys.exit(0)
print('Yes')

Solution (Python):


n = int(input().split()[0])

txy_list = []

for i in range(0, n):
    work_list = list(map(int, input().split()))
    txy_list.append(work_list)

pre_txy = [0, 0, 0]
answer = False

for txy in txy_list:
    t, x, y = txy[0], txy[1], txy[2]
    pre_t, pre_x, pre_y = pre_txy[0], pre_txy[1], pre_txy[2]

    t_w, x_w, y_w = t - pre_t, abs(x - pre_x), abs(y - pre_y)
    work = t_w - (x_w + y_w)

    if (work % 2 == 0) and (work >= 0):
        pre_txy = txy
        continue
    else:
        break
else:
    answer = True

a = 'Yes' if answer else 'No'
print(a)

Solution (Python):
N = int(input())
z = [list(map(int, input().split())) for _ in range(N)]

for i in range(N):
	tmp = abs(z[i][1] + z[i][2])
	if z[i][0] % 2 == 0:
		if tmp % 2 == 0 and tmp <= z[i][0]:
			pass  
		else:
			print("No")
			exit()
	else:
		if tmp % 2 != 0 and tmp <= z[i][0]:
			pass
		else:
			print("No")
			exit()
print("Yes")

Solution (Python):
n=int(input())
root=[]
t,x,y=0,0,0
for i in range(n):
    ti,xi,yi=map(int,input().split())
    if ti-t<xi-x+yi-y or (ti-t)%2!=(xi-x+yi-y)%2:
        print("No")
        break
    t,x,y=ti,xi,yi
else:
    print("Yes")

Solution (Python):
def is_possible(t0, x0, y0, t, x, y):
    dt, dm = t - t0, abs(x - x0) + abs(y - y0)
    if dt < dm:
        return False
    if (dt + dm) % 2 == 0:
        return True
    return False
n = int(input())
path = [(0, 0, 0)]
can_travel = True
for _ in range(n):
    t0, x0, y0 = path[-1]
    t, x, y = (int(i) for i in input().split())
    can_travel &= is_possible(t0, x0, y0, t, x, y)
    path.append((t, x, y))

print('Yes' if can_travel else 'No')