peterverebics/CodeNet_Python_118 huggingface dataset:
import fileinput

def main():
	pos = [0, 0, 0]
	lines = [line.rstrip() for line in fileinput.input()]
	for line in lines[1:]:
		t, x, y = map(lambda x: int(x), line.split())
		dest = abs(x - pos[1]) + abs(y - pos[2])
		dt = t - pos[0]
        
        
		if dest <= dt and dest % 2 == t % 2:
			pos[0] = t
			pos[1] = x
			pos[2] = y
			next
		else:
			return print("No")
	print("Yes")
                
main()
n = int(input())
pret = 0
prex = 0
prey = 0
flag = True
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - x - y - pret + prex + prey
        #print(t, x, y, tmp)
        if tmp == 0 or tmp == 4 or (tmp - 9) % 4 == 0:
            pret = t
            prex = x
            prey = y
        else:
            flag = False
if flag:
    print('Yes')
else:
    print('No')
c = input()
data = []
for s in range(0,int(c)):
  data.append(list(map(int, input().split())) )

nowtime = 0
nowx = 0
nowy = 0

nexttime = 0
nextx = 0
nexty = 0

costtime = 0
diffx = 0
diffy = 0

for s in range(0, len(data)):
  nexttime = data[s][0]
  nextx = data[s][1]
  nexty = data[s][2]
  costtime = nexttime - nowtime
  diffx = abs(nextx - nowx)
  diffy = abs(nexty - nowy)
  if ( (costtime < diffx + diffy) or ((((diffx + diffy) - costtime ) % 2) == 1 ) ):
    print("NO")
    exit()
  nowtime = nexttime
  nowx = nextx
  nowy = nexty



print("YES")
N = int(input())
P = [[0,0,0]]+[list(map(int,input().split())) for n in range(N)]
ans = "Yes"

for n in range(N):
  dt = P[n+1][0]-P[n][0]
  dx = P[n+1][1]-P[n][1]
  dy = P[n+1][2]-P[n][2]  
  if dt<dx+dy or dt%2!=(dx+dy)%2:
    ans = "No"

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

for i in range(n):
  if txy[i][1] + txy[i][2] > txy[i][0]:
    status = "No"
    break
  elif (txy[i][1]+txy[i][2])%2 != txy[i][0]%2:
    status = "No"
    break
  else:
    status = "Yes"
    
print(status)
N=int(input())
x=y=t=0
flag=True
for i in range(N):
  ti, xi, yi = map(int, input().split())
  dist = abs(xi-x)+abs(yi-y)
  dt = ti-t
  x, y = xi, yi
  if dist<=t and dist%2==dt%2:
    continue
  else:
    flag=False
print("Yes") if flag else print("No")
N=int(input())
count=0
for i in range(N):
    t,x,y=map(int,input().split())
    if x+y<=t and t==(x+y):count+=1
print("Yes" if count==N else "No")
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
for li in [rl() for _ in range(n)]:
    t, a, b = li
    if t < abs(a) + abs(b) or (t - a - b) & 1:
        print('No')
        exit()
print('Yes')
N = int(input())
dt, dx, dy = 0, 0, 0
avilable = True
for i in range(N):
    t, x, y = map(int, input().split())
    if abs(x-dx)+abs(y-dy) > t-dt or (abs(x-dx)+abs(y-dy)) % 2 != (t-dt) % 2:
        avilable = False
if avilable:
    print('Yes')
else:
    print('No')
import sys
n = int(input())
lis = [list(map(int,input().split())) for _ in range(n)]
t = 0
x = 0
y = 0
for i in range(n):
    if lis[i][0] % (lis[i][1] + lis[i][2]) == 0 and (lis[i][0] - t >= abs(lis[i][1]-x) + abs(lis[i][2]-y)):
        x = lis[i][1]
        y = lis[i][2]
        t = lis[i][0]
    else:
        print("No")
        sys.exit()
print("Yes")
# 2020/03/14
# AtCoder Beginner Contest 086 - C

# Input
n = int(input())
nx = 0
ny = 0

# Check
ans = "Yes"
for i in range(n):
    t, x, y = map(int,input().split())
    dist = abs(nx - x) + abs(ny - y)
    if dist > t or (dist <= t and dist % 2 == 0):
        ans = "No"
        break
    nx = x
    ny = y

# Output
print(ans)
n=int(input())
kot="Yes"
for i in range(n):
  a=list(map(int,input().split()))
  
  if a[1]<0:
    a[1]=a[1]*-1
  if a[2]<0:
    a[2]=a[2]*-1
  if a[0]%2!=(a[1]+a[2])%2:
    kot="No"
    break
  if a[0]<a[1]+a[2]:
    kot="No"
    break

print(kot)
n = int(input())

t0, x0, y0 = 0, 0, 0
for l in [list(map(int, input().split())) for i in range(n)]:
    if (l[0] - (abs(l[1]) + abs(l[2]))) < 0 or (l[0] - (abs(l[1]) + abs(l[2]))) % 2 != 0:
        print('No')
        exit()
    t0, x0, y0 = l[0], l[1], l[2]
print('Yes')
N=int(input())
a=[list(map(int,input().split())) for _ in range(N)]
dp=[[0,0] for _ in range(N+1)]
dp[0][0]=1
for i in range(N):
  t=a[i][0]-dp[i-1][1]
  x=a[i][1]
  y=a[i][2]
  if t>=x+y and t%2==(x+y+dp[i-1][1])%2 and dp[i-1][0]==1:
    dp[i][0]=1
    dp[i][1]=a[i][0]
if dp[N-1][0]==1:print("Yes")
else:print("No")
# ABC86 C - Traveling
N = int(input())
ans = "Yes"
t, x, y = 0, 0, 0
for i in range(N):
    ti, xi, yi = map(int, input().split())
    dt, dx, dy = ti - t, abs(xi - x), abs(yi - y)
    if (dt - (dx + dy)) % 2 == 0:
        t, x, y = ti, xi, yi
    else:
        ans = "No"
        break
print(ans)
N = int(input())
t=[0]*(N+1); x=[0]*(N+1); y=[0]*(N+1)
t_diff=0; x_diff=0; y_diff=0

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

print(t, x, y)

for i in range(N):
    t_diff = t[i+1]-t[i]
    x_diff = abs(x[i+1]-x[i])
    y_diff = abs(y[i+1]-y[i])
    if t_diff%2 != (x_diff+y_diff)%2 or t[i+1] < (x[i+1]+y[i+1]):
        print("No")
        exit()

print("Yes")
n = int(input())
a = 0
b = 0
c = 0
for i in range(n):
    t,x,y = map(int,input().split())
    if (t%2 != ((x-b) + (y-c))%2):
        if (t - a) < ((x - b) + (y - c)):
            print("No")
            exit()
    else:
        print("No")
        exit()
    a,b,c = t,x,y       
print("Yes")
n = int(input())
 
flg = True
t_ = 0
x_ = 0
y_ = 0

for i in range(n):
  t, x, y = map(int, input().split())
  t_ = abs(t - t_)
  x_ = abs(x - x_)
  y_ = abs(y - y_)
  
  if t_ - x_ - y_ <= 0:
    print('No')
    flg = False
    break
  elif (t_ - x_ - y_) % 2 != 0:
    print('No')
    flg = False
    break
  t_ = t
  x_ = x
  y_ = y
 
if flg:
  print('Yes')
N = int(input())
li = []
pre_t = 0
pre_x = 0
pre_y = 0
ans = "Yes"
for _ in range(N):
    t, x, y = map(int, input().split())
    if (abs(x - pre_x) + abs(y - pre_y) > abs(t - pre_t)) or (
        x == pre_x and y == pre_y and (t - pre_t) % 2 != 0
    ):
        ans = "No"

    pre_t, pre_x, pre_y = t, x, y

print(ans)
n=int(input())
t0=0
x0=0
y0=0
def num_abs(num):
    return abs(num)
ans=0
for i in range(n):
    t,x,y=map(int,input().split())
    numx=num_abs(x-x0)
    numy=num_abs(y-y0)
    if numx+numy>t or (t-(numx+numy))%2==1:
        ans=1
        break
if ans==1:
    print("No")
else:
    print("Yes")
n = int(input())
t,x,y = map(int,input().split())

NO = 0

for i in range(n):
    if abs(x)+ abs(y) > t or (abs(x) + abs(y) + t) % 2==1:
        NO = NO + 1

if NO == 0:
    print("Yes")
else:
    print("No")
#!/usr/bin/env python3

N = int(input())
A = []
for i in range(N):
    A.append([int(i) for i in input().split()])

t0 = 0
x0 = 0
y0 = 0
flg = True
for t1,x1,y1 in A:
    dt = t1 - t0
    dx = abs(x1-x0)
    dy = abs(y1-y0)
    if dt < dx+dy or dt % 2 != (dx+dy) % 2:
        flg = False
        break

if flg:
    print("Yes")
else:
    print("No")
c = input()
data = []
for s in range(0,int(c)):
  data.append(list(map(int, input().split())) )

nowtime = 0
nowx = 0
nowy = 0

nexttime = 0
nextx = 0
nexty = 0

costtime = 0
diffx = 0
diffy = 0

for s in range(0, len(data)):
  nexttime = data[s][0]
  nextx = data[s][1]
  nexty = data[s][2]
  costtime = nexttime - nowtime
  diffx = abs(nextx - nowx)
  diffy = abs(nexty - nowy)
  if ( (costtime < diffx + diffy) or ((((diffx + diffy) ) % 2) == (costtime % 2) ) ):
    print("NO")
    exit()
  nowtime = nexttime
  nowx = nextx
  nowy = nexty



print("YES")
n = int(input())
st = 0
sx, sy = 0, 0
ng = False
for _ in range(n):
    t, x, y = map(int, input().split())
    dt = (t - st)
    dx = abs(sx - x)
    dy = abs(sy - y)

    if dt%2 == (dx+dy)%2 and dx+dy <= dt:
        continue
    else:
        ng = True
        break
print('No' if ng else 'Yes')
# -*- coding:utf-8 -*-

n = int(input())
t, x, y = [0], [0], [0]
for i in range(n):
  t_i, x_i, y_i = map(int, input().strip().split())
  t.append(t_i)
  x.append(x_i)
  y.append(y_i)

  
can = "YES"
for i in range(n):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if (dt < dist):
    can = "NO"
  if(dist % 2 != dt % 2):
    can = "NO"
print(can)
N = int(input())

px = 0
py = 0
pt = 0

for _ in range(N):
  T, X, Y = (int(i) for i in input().split())

  d = (X - px + Y - py)
  dt = (T - pt)
  if d > dt or (d % 2) != (dt % 2):
    print('No')
    import sys
    sys.exit()
  else:
    px = X
    py = Y
    pt = T

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

for i in range(n):
  if txy[i][1] + txy[i][2] >txy[i][0]:
    status = "No"
    break
  elif (txy[i][1]+txy[i][2])%2 != txy[i][0]%2:
    status = "No"
    break
  else:
    status = "Yes"
    
print(status)
n = int(input())

No = 0

for i in range(n):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t) % 2 == 1:
    No = No + 1

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

T = 0
X = 0
Y = 0
for i in range(N):
    t, x, y = map(int, input().split())
    if (t - T) < abs(x-X) + abs(y-Y) or ((t - T) + abs(x-X) + abs(y-Y))%2 == 1:
        print("No")
        break
    t = T
    X = x
    Y = y
else:
    print("Yes")
import numpy as np
n=int(input())
x=[list(map(int, input().split())) for _ in range(n)]

now=0
nplace=[0,0]
noflag=False
for y in x:
    dis=sum(map(abs, (np.array(y[1:]) - np.array(nplace))))
    if not (dis>0 & (dis-y[0])%2==0):
        noflag=True
    now=y[0]
    nplace=y[1:]
print('Yes') if noflag==False else print('No')
n=int(input())
xyt=[list(map(int,input().split())) for _ in range(n)]
for i in range(1,n):
  dx,dy,dt=xyt[i][0]-xyt[i-1][0],xyt[i][1]-xyt[i-1][1],xyt[i][2]-xyt[i-1][2]
  if (dx+dy-dt)%2!=0:
    print('No')
    exit()
print('Yes')
N = int(input())
plan = [list(map(int, input().split())) for i in range(N)]
m = 0
for i in range(N-1):
    time = plan[i+1][0]-plan[i][0]
    dist = abs(plan[i+1][1]-plan[i][1])+abs(plan[i+1][2]-plan[i][2])
    if dist>time:
        m = 1
        break
    if dist%2 == time%2: 
        continue
print('Yes' if m==0 else 'No')
N = int(input())
T = [0 for _ in range(N)]
X = [0 for _ in range(N)]
Y = [0 for _ in range(N)]
count = 0
t = 0
x = 0
y = 0

for i in range(N):
    T[i], X[i], Y[i] = map(int, input().split())
    t = T[i] -t
    x = X[i] -x
    y = Y[i] -y
    if t>= x+y:
        if t%2==(x+y)%2==0 or (t%2 != 0 and (x+y)%2 != 0):
            count +=1
        else:
            break
print('Yes' if count==N else 'No')
n = int(input())

x_now, y_now, t_now = 0, 0, 0

for i in range(n):
    t, x, y = map(int, input().split())
    if ((t -t_now) - abs(x-x_now) - abs(y-y_now)) % 2 == 0 :
        x_now,y_now,t_now = x,y,t
    else:
        print('No')
        exit()

print('Yes')
N=int(input())
flag=0

x=[list(map(int,input().split())) for _ in range(N)]
x.insert(0,[0,0,0])



for i in range(N):
  if abs(x[i][0]-x[i+1][0])<(abs(x[i][1]-x[i+1][1])+abs(x[i][2]-x[i+1][2])):
    flag=1
  if x[i][1]==x[i+1][1] and x[i][2]==x[i+1][2]:
    flag=1

if flag==0:
  print("Yes")
else:
  print("No")
n=int(input())
 
for i in range(n):
 x_start=0
 y_start=0
 t_start=0
 t,x,y=map(int,input().split())
 
 dist=abs(t-t_start)
 dt=abs(x-x_start)+abs(y-y_start)
 
 if dist<dt or dt%2!=dist%2:
  print("No")
  exit()
  
print("Yes")
# AtCoder Beginner Contest 086
# C - Traveling

N=int(input())

T=0
X,Y=0,0

for i in range (N):
    t, x, y =map(int,input().split())
    time =t-T
    distance=(x+y)-(X+Y)
    if time >= distance and time%2==distance%2:
        pass
    else :
        print("No")
        exit()
print("Yes")
n=int(input())

a,b,c=0,0,0

for i in range(n):
  x,y,z=map(int,input().split())
  dist=abs(b-y)+abs(c-z)
  if dist>x-a or dist-(x-a)%2==1:
    print('No')
    exit()
    
  else:
    a,b,c=x,y,z
    continue
    
print('Yes')
N = int(input())

T = []
ti = 0
xi = 0
yi = 0
flag = True
# t+1に点(x+1,y),(x−1,y),(x,y+1),(x,y−1)の
for i in range(N):
    T.append(list(map(int, input().split())))


for t, x, y in T:
    dift = t - ti
    difx = x - xi
    dify = y - yi
    dif = difx + dify
    ti = t
    xi = x
    yi = y
    if dift % dif == 0:
        continue
    else:
        flag = False
        break


if flag:
    print("Yes")
else:
    print("No")
N = int(input())
A = [input().split() for _ in range(N)]

if N ==1:
  n = int(A[0][0])
  move = int(A[0][1]) + int(A[0][2]) 
  if move > n or move%2 != n%2:
    print("NO")
  else:
    print("YES")
  
for i in range(1,N):
  H = int(A[i][1]) - int(A[i -1][1])
  V = int(A[i][2]) - int(A[i -1][2])
  move = H + V
  n = int(A[i][0]) - int(A[i -1][0])
  if move > n or move%2 != n%2:
    print("NO")
    break
  elif i == N -1:
    print("YES")
N = int(input())
t, x, y = 0, 0, 0
for _ in range(N):
	_t, _x, _y = map(int, input().split())
	d_xy = abs(x - _x) + abs(y - _y)
	d_t = _t - t
	if d_xy <= d_t and d_xy%2 == d_t%2:
		pass
	else:
		print("No")
		exit()
print("Yes")
n = int(input())
pos = [list(map(int, input().split())) for _ in range(n)]

def func(n, pos):
    c_t, c_x, c_y = 0, 0, 0

    for i in pos:
        d_t = i[0] - c_t
        z = (i[1] - c_x) + (i[2] - c_y)

        if z > d_t or (d_t - z) % 2 != 0:
            return "No"
        else:
            c_t, c_x, c_y = 0, 0, 0

    return "Yes"


print(func(n, pos))
import sys
n=int(input())
px=0
py=0
pt=0
for i in range(n):
    t,x,y=map(int,input().split())
    if abs(x-px)+abs(y-py)>t-pt or abs(x-px)+abs(y-py)%2!=(t-pt)%2:
        print('No')
        sys,exit()
    else:
        px=x
        py=y
        pt=t
print('Yes')
n = int(input())

points = []
for i in range(n):
    points.append([i for i in map(int, input().split())])

can = True
for i in range(len(points)-1):
    move_n = points[i+1][0] - points[i][0]
    dist = abs(points[i+1][1] - points[i][1]) + abs(points[i+1][2] - points[i][2])
    if move_n < dist or dist % 2 != move_n % 2:
        can = False 
        break

if can:
    print('Yes')
else:
    print('No')
n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]

T=X=Y=0
ok = True
for t,x,y in txy:
  if abs(X-x)+abs(Y-y) <= t-T:
    if (t-T)%2 == 0:
      if (abs(X-x)+abs(Y-y))%2!=0:
        ok = False
        break
    else:
      if (abs(X-x)+abs(Y-y))%2==0:
        ok = False
        break
  else:
    ok = False
    break
print("Yes" if ok else "No")
n=int(input())

num,a,b=0,0,0

for i in range(n):
  t,x,y=map(int,input().split())
  num,a,b=abs(t-num),abs(x-a),abs(y-b)
  su=a+b
  if num<su:
    ans="No"
    break
  elif su==0 and num%2==0:
    ans="Yes"
    break
  elif su==0 and num%2!=0:
    ans="No"
    break
  else:
    if num%2 != su%2:
      ans="No"
    elif num%su==0:
      ans="Yes"
    else:
      ans="Yes"
      
print(ans)
n = int(input())
location = [list(map(int, input().split())) for j in range(n)]
counter = 0
adj_t, adj_x, adj_y = 0,0,0

for i in range(n):
    time = location[i][0] - adj_t
    x = location[i][1] - adj_x
    y = location[i][2] - adj_y
    dst = abs(x) + abs(y)
    if dst <=time and dst in range(time, 0, -2):
        counter += 1
    adj_t = time
    adj_x = x
    adj_y = y
    
if counter == len(location):
    print('Yes')
else:
    print('No')
n = int(input())

for _ in range(n):
    t, x, y = map(int, input().split())
    if (x+y)%2 == t%2 and x+y <= t:
        continue
    else:
        print('No')
        exit()
print('Yes')
N = int(input())
tm_pos = [list(map(int, input().split())) for i in range(N)]
for i in tm_pos:
    if i[0] < i[1] + i[2] or i[0] % 2 != (i[1] + i[2]) % 2:
        print('No')
        exit()
print('Yes')
N = int(input())

t = [0]
x = [0]
y = [0]
for i in range(N):
    l = [int(c) for c in input().split()]
    t.append(l[0])
    x.append(l[1])
    y.append(l[2])

for i in range(N-1):
    move = x[i+1]-x[i] + y[i+1]-y[i]
    time = t[i+1]-t[i]
    if time%2 ^ move%2 == 1 or time < move:
        print("No")
        exit()

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

from numpy import array 

i=0
o=array([0,0,0])
while i<n:
   t,x,y=map(int,input().split())
   z=array([t,x,y])
   w=z-o
   a,b=map(str,[bin(w[0]),bin(w[1]+w[2])])

   if w[0]<w[1]+w[2]:
       print("No")
       break

   else:
       if a==b:
           o=o+w
           i=i+1
       else:
           print("No")
           break
else:
    print("Yes")
n = int(input())
a = 0
b = 0
c = 0
for i in range(n):
    t,x,y = map(int,input().split())
    if (t%2 != ((x-b) + (y-c))%2) or ((t-a)%2 != ((x-b) + (y-c))%2):
        print("No")
        exit()
        if (t - a) < ((x - b) + (y - c)):
            print("No")
            exit()
    a,b,c = t,x,y       

        

print("Yes")
N = int(input())
ll = []

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


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

for i in range(1,N+1):
    if ll[i][0] % 2 == ((ll[i][1] + ll[i][2]) % 2) and (ll[i][0] - ll[i-1][0]) >= (ll[i][1] + ll[i][2]):
        ans = 1
    else:
        print('No')
        exit()

print('Yes')
n = int(input())

tn = 0
xn = 0
yn = 0
j = True
for i in range(n):
    td, xd, yd = map(int, input().split())
    t = td - tn
    x = abs(xd - xn)
    y = abs(yd - yn)
    if t%2 == (x + y)%2 and (x + y) <= t:
        continue
    j = False
if j:
    print("Yes")
else:
    print("No")
N = int(input())

ans = 'Yes'

tt, tx, ty = 0, 0, 0,
for _ in range(N):
    t, x, y = map(int, input().split())
    ct = t-tt
    cx = x-tx
    cy = y-ty
    if ct < (cx+cy):
        ans = 'No'
        break
    if cx+cy == 0:
        ans = 'No'
        break
    if ct%(cx+cy) != 0:
        ans = 'No'
        break
    tt, tx, ty = t, x, y

print(ans)
#traveling
n=int(input())
flag=True
lists=[(0,0,0)]
for i in range(n):
    a=list(map(int,input().split()))
    lists.append(tuple(a))
for i in range(1,n+1):
    x,y,z=lists[i-1][0],lists[i-1][1],lists[i-1][2]
    a,b,c=lists[i][0],lists[i][1],lists[i][2]
    if abs(b-y)+abs(c-z)<=abs(a-x) and abs(b-y)%2+abs(c-z)%2==abs(a-x)%2:
        pass
    else:
        flag=False
        break
if flag:
    print("Yes")
else:
    print("No")
N = int(input())

for i in range(N):
    t_i, x_i, y_i = map(int, input().split()) #ここまでOK

for i in range(N):
    x_i = abs(x_i)
    y_i = abs(y_i)
    t_i = abs(t_i)


    if (x_i+y_i)> t_i:
        print("No")
        exit()
    elif (x_i+y_i) %2 != t_i%2 :
        print("No")
        exit()

print("Yes")
n=int(input())
bx=by=0
ans='Yes'

for i in range(n):
    t,x,y=map(int, input().split())
    if t%2!=(x+y)%2:
        ans='No'
    if abs(bx-x)+abs(by-y)>t:
        ans='No'
    bx=x
    by=y

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:
        print("No")
        exit()
print("Yes")
N = int(input())

ts,xs,ys = 0,0,0

for i in range(N):
    t,x,y = map(int,input().split())
    if x-xs + y-ys > t-ts:
        print("No")
        break
    else:
        if (x-xs + y-ys - t-ts) % 2 != 0:
            print("No")
            break
        else:
            ts,xs,ys = t,x,y
    
if ts == t:
    print("Yes")
n=int(input())
txy=[list(map(int,input().split())) for _ in range(n)]
txy.insert(0,[0,0,0])
for i in range(1,n+1):
  d=abs(txy[i][1]-txy[i-1][1])+abs(txy[i][2]-txy[i-1][2])
  if ((txy[i][0]-txy[i-1][0])-d)<0 or d%2==0:
    print("No")
    exit()
print("Yes")
#!/usr/bin python3
# -*- coding: utf-8 -*-

import numpy as np

def canReach(src, dst):
    a = np.sum(np.abs(src-dst)[1:3]) - (dst[0] - src[0])
    if a >= 0 and a % 2 == 0:
        return True
    return False

N = int(input())
dst = np.array([[int(x) for x in input().split(" ")] for z in range(N)])

available = True
pos = [0, 0, 0]

for n in range(N):
    if not canReach(pos, dst[n]):
        available = False
        break
    else:
        pos = dst[n]

if available:
    print("Yes")
else:
    print("No")
N = int(input())
for i in range(N):
  t,x,y = map(int, input().split())
  if (t%2)+(x+y)%2 == 1 or x+y > t:
      print("No")
      exit()
print("Yes")
N=int(input())
count=0
for i in range(N):
    t,x,y=map(int,input().split())
    if x+y<=t:
      count+=1
print("Yes" if count==N else "No")
n = int(input())

def check(t, x, y):
    return (t - (abs(x) + abs(y))) >= 0 and (t - (abs(x) + abs(y))) % 2 == 0

if all(check(l[0], l[1], l[2]) for l in [list(map(int, input().split())) for i in range(n)]):
    print('Yes')
else:
    print('No')
N = int(input())
ans = 'Yes'

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

travel = list()
#start point
travel.append((0,0,0))

for i in range(n):
  travel.append(tuple(map(int,input().split())))


for j in range(n):
  dist = abs(travel[j][0]-travel[j+1][0])

  dd = abs(travel[j][1]-travel[j+1][1])+abs(travel[j][2]-travel[j+1][2])
  
#fail
  if dist < dd or (dd%2 != dist%2):
    print("NO")
    exit(0) 

print("YES")
print('YNeos'[any((t+x+y)%2+(t<x+y)for t,x,y in zip(*[map(int,[*open(0)][1].split())]*3))::2])
N = int(input()) 
P = [list(map(int, input().split())) for i in range(N)] 
P.insert(0,[0,0,0])

ans = "YES"
for i in range(N):
	norm = abs(P[i+1][1]-P[i][1])+abs(P[i+1][2]-P[i][2])
	move = (P[i+1][0]-P[i][0]) - norm
	if ((move%2 != 0) or (move < 0)):
		ans = "NO"
		break
	
print(ans)
N = int(input())
point = [0, 0]
t_list = []
ans = "Yes"
t = list(map(int, input().split()))
dis = abs(point[0]-t[1])+abs(point[1]-t[2])
t_list.append(t)
if t[0] < dis:
    ans = "No"
point = [t[1], t[2]]
for i in range(N-1):
    t = list(map(int, input().split()))
    dis = abs(point[0]-t[1])+abs(point[1]-t[2])
    if t_list[-1][0]-t[0] < dis:
        ans = "No"
    point = [t[1], t[2]]
    t_list.append(t)
print(ans)
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

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

t = [0]
x = [0]
y = [0]
for i in range(N):
    l = [int(c) for c in input().split()]
    t.append(l[0])
    x.append(l[1])
    y.append(l[2])

for i in range(N-1):
    move = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
    time = t[i+1]-t[i]
    if time%2 ^ move%2 == 1 or time < move:
        print("No")
        exit()

print("Yes")
import sys
n = int(input())
txy = []
for i in range(n):
  txy.append(list(map(int, input().split())))
pt = 0
py = 0
px = 0
for t, x, y in txy:
  dt = t - pt
  dx = x - px
  dy = y - py
  ax = abs(dx) % 2
  ay = abs(dy) % 2
  a = ax + ay % 2
  if abs(dx) + abs(dy) > dt or a != dt % 2:
    print("No")
    sys.exit()
print("Yes")
import numpy

N=int(input())
S = numpy.zeros(N*3,dtype=int).reshape(N,3)
for i in range(N):
	S[i,:]= list(map(int,input().split())) 

i=0
while i <N:
	L=S[i,0] - S[i,1] - S[i,2]
	if L<0:
		break
	elif L%2==0:
		i+=1
	else:
		break

if i ==N:
	print("YES")
else:
	print("NO")
N = int(input())
#ans = 'Yes'

for i in range(N):
    t,x,y = map(int,input().split())
    t = t-(x+y)
    
    if t % 2 == 0:
        continue
    else:
        print('No')
        exit()
print('Yes')
n = int(input())
txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]

flag = True
for i in range(1, n + 1):
    t = txy[i][0] - txy[i - 1][0]
    x = txy[i][1] - txy[i - 1][1]
    y = txy[i][2] - txy[i - 1][2]

    if not t >= x + y or not t % 2 == (x + y) % 2:
        flag = False
        break

print('Yes') if flag else print('No')
n = int(input())
 
result = []
 
for i in range(n):
    t, x, y = map(int, input().split())
 
    if t % 2 == 0:
        result.append(True) if ((x + y) % 2 == 0) & (t >= x + y) else result.append(False)
    else:
        result.append(True) if ((x + y) % 2 == 1) & (t >= x + y) else result.append(False)
 
print("Yes" if all(result) else "No")