peterverebics/CodeNet_Python_118 huggingface dataset:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

N = int(input())
prev_dst = [0,0,0]

for n in range(N):
    t, x, y = map(int, input().split(" "))
    a = (t - prev_dst[0]) - (abs(prev_dst[1]-x) + abs(prev_dst[2]-y))
    if a >= 0 and a % 2 == 0:
        prev_dst = [t, x, y]
    else:
        print("No")
        exit(0)

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

tx = 0
ty = 0
tt = 0

for i in range(n):
    dx = abs(ab[i][1] - tx)
    dy = abs(ab[i][2] - ty)
    dt = ab[i][0] -tt
    dd = dt- (dx+dy)
    if dd % 2 ==0 and dd>=0:
        tx = ab[i][1]
        ty = ab[i][2]
        tt = ab[i][0]

    else:
        print("No")
        exit()

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

placeSequence = list()
for pivot in range(timeNum):
  placeSequence.append(list(map(int, input().split(' '))))

def compatibleCoordinate(time, x, y):
  if time % 2 == (abs(x) +  abs(y)) % 2 and time >= abs(x) + abs(y):
    return True
  else:
    return False

time = x = y = 0

for place in placeSequence:
  objectTime, objectX, objectY = place
  flag = compatibleCoordinate(objectTime-time, objectX-x, objectY-y)
  if flag:
    time = objectTime
    x = objectX
    y = objectY
    continue
  else:
    print('No')
    break

else:
  print('Yes')
t, x, y = 0, 0, 0
for i in range(int(input())):
	next_t, next_x, next_y = map(int, input().split())
	diff = abs(x - next_x) + abs(y - next_y)
	if diff > (next_t - t) or (diff - (next_t - t)) % 2 == 1:
		print("No")
		exit(0)
	t, x, y = next_t, next_x, next_y
print("Yes")
def dif(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(dif, 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")
n = int(input())
t1 = x1 = y1 = 0
flag = 0
for i in range(n):
    t2, x2, y2 = map(int,input().split())
    if t2-t1 >= abs(x2-x1)+abs(y2-y1) and (t2-t1)%2 == (abs(x2-x1)+abs(y2-y1))%2:
        pass
    else:
        flag = 1
    t1, x1, y1 = t2, x2, y2
if flag == 1:
    print('No')
else:
    print('Yes')
for _ in range(int(input())):
  t, x, y = map(int,input().split())
  if (t+x+y)%2 + (t<x+y):
    s = 1
    break
  s = 0
print("YNeos"[s::2])
n = int(input())
t, x, y = 0, 0, 0
for _ in range(n):
    D = list(map(int, input().split()))
    dt = D[0] - t
    dx = D[1] - x
    dy = D[2] - y
    l = abs(dx) + abs(dy)
    if dt < l:
        print('No')
        exit()
    if dt % 2 != l % 2:
        print('No')
        exit()
    t, x, y = dt, dx, dy
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()
	t, x, y = _t, _x, _y
print("Yes")
n = int(input())
cnt = 0
t,x,y = 0,0,0
for i in range(n):
  nt, nx, ny  = map(int, input().split())
  if not(abs(nx-x)+abs(ny-y) <= nt-t and t%2 == (x+y)%2):
    print("No")
    exit()
print("Yes")
N = int(input())
xy=[]
try :
  while True:
    t = input().split()
    t = list(map(int,t))
    if t:
      xy.append(t)
    else :
      break
except EOFError:
  pass
loc = [0,0]
time = 0
for i in range(N):
  a = xy[i]
  time = a[0]-time
  dis = abs(loc[0]-a[1])+abs(loc[1]-a[2])
  if (time-dis)<0 :
    print("No")
    exit()
  elif (time-dis)%2 == 1:
    print("No")
    exit()
    
  else :
    loc = [a[1],a[2]]
    
  
else :
  print("Yes")
N = int(input())

locx = 0
locy =0
time = 0
for i in range(N):
  t,x,y = map(int,input().split())
  time = t-time
  dis = abs(locx-x)+abs(locy-y)
  if (time-dis)<0 :
    print("No")
    exit()
  if (time-dis)%2 == 1:
    print("No")
    exit()
    
  
  
  locx = x
  locy = y
    
  
else :
  print("Yes")
N = int(input())
ti_xi_yi = [map(int, input().split(' ')) for n in range(N)]
for ti, xi, yi in ti_xi_yi:
    if not (abs(xi+yi) <= abs(ti) and abs(xi)+abs(yi) <= abs(ti) and ti%2 == (xi+yi)%2):
        print('No')
        exit()
print('Yes')
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N = int(readline().rstrip())
pos = (0, 0)
used_time = 0
for _ in range(N):
    t, x, y = map(int, readline().split())
    cost = abs(pos[0] - x) + abs(pos[1] - y)
    available = t - used_time
    # print("cost: {}".format(cost))
    # print("available: {}".format(available))
    if cost > available or (cost - available) % 2 != 0:
        print('No')
        quit()
    used_time += t
    pos = (x, y)
print('Yes')
n = int(input())

flag = 0
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[i] > x[i]+y[i]:
    flag += 1
  if t[i]%2 != (x[i]+y[i])%2:
    flag +=1
  if i > 1:
    if abs(t[i-1]-t[i]) > abs(x[i-1]+y[i-1])-abs(x[i]+y[i]):
      flag +=1

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

t_0 = 0
x_0 = 0
y_0 = 0
flag = True

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

    if abs(x-x_0) + abs(y-y_0) <= abs(t-t_0) and (abs(x-x_0)+abs(y-y_0))%2 == abs(t-t_0)%2:
        continue
    flag = False

print("Yes" if flag else "No")
n = int(input())
for _ in range(n):
    t,x,y = map(int,input().split())
    if (t%2 != (x + y)%2) or (t%2 != (x + y)%2):
        print("No")
        exit()
    elif t < (x + y):
        print("No")
        exit()
    else:
        continue
print("Yes")
n = int(input())
pre_t = 0
for i in range(n):
    t, x, y=map(int, input().split())
    if (x + y) > (t - pre_t) or (x + y + (t - pre_t)) % 2:
        print("No")
        exit()
    pre_t = t
print("Yes")
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
# while flag=='Yes' and i<len(T)-1:
#     t1,x1,y1 = T[i] 
#     t2,x2,y2 = T[i+1]
#     dis = abs(x2-x1)+abs(y2-y1)
#     _t = t2-t1
#     if dis > _t or _t%2 != dis%2:
#         flag = 'No'
#     i += 1        
print(flag)
# coding: utf-8
import math
n = int(input())
t = 0
x = 0
y = 0
txy = []
for i in range(n):
    ti, xi, yi = list(map(int, input().split()))
    txy.append((ti, xi, yi))

for ti, xi, yi in txy:
    if xi - x + yi - y > ti - t:
        print("NO")
        exit()
    elif (xi - x + yi - y - (ti - t)) % 2 != 0:
        print("NO")
        exit()
    else:
        t = ti
        x = xi
        y = yi
print("YES")
N = int(input())
a=[0]*(N+1)
a[0]=[0,0,0]
for i in range(1,N+1):
    a[i]=[int(j) for j in input().split()]

flag = True
for i in range(N):
    distance = abs(a[i][1]-a[i+1][1]) + abs(a[i][2]-a[i+1][2])
    del_t = a[i+1][0]-a[i][0]

    if del_t - distance < 0 or (del_t - distance)%2 != 0:
        flag = False
        
if flag:
    print("Yes")
else:
    print("NO")
N = int(input())
t = [0]*100001
x = [0]*100001
y = [0]*100001
for n in range(N):
    t[n+1], x[n+1], y[n+1] = map(int, input().split())
ans = True
for n in range(N):
    dt   = t[n+1] - t[n]
    dist = (x[n+1] - x[n]) + (y[n+1] - y[n])
    if dt < dist:
        ans = False
    if dt % 2 != dist % 2:
        ans = False
if ans:
    print('Yes')
else:
    print('No')
"""
a,b,c=map(int,input().split())
s=[a,b,c]
s.sort()
print(s[0]+s[1])
"""
n = int(input())
count=0
temp=0
xtemp=0
ytemp=0
for i in range(0,n):
    t,x,y = map(int, input().split())
    if (t-temp)>=x-xtemp+y-ytemp and (x-xtemp+y-ytemp-(t-temp))%2==0:
        count=count+1
    temp=t
    xtemp=x
    ytemp=y
if count==n:
    print("Yes")
else:
    print("No")
n = int(input())
now = [0, 0, 0]
def ng():
  print('No')
  exit()
for i in range(n):
  t, x, y = map(int, input().split())
  if t % 2 != (x + y) % 2:
    ng()
  if abs(x - now[1]) + abs(y - now[2]) > t - now[0]:
    ng()
print('Yes')
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
    t1,x1,y1 = T[i] 
#     t2,x2,y2 = T[i+1]
#     dis = abs(x2-x1)+abs(y2-y1)
#     _t = t2-t1
#     if dis > _t or _t%2 != dis%2:
#         flag = 'No'
    i += 1        
print(flag)
n = int(input())

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

  if x+y<=t-res and t%2==(x+y)%2:
    if t-(x+y)!=res:
      res += t-(x+y)
  else:
    print('No')
    exit()
    
print('Yes')
n = int(input())
X, Y, T=0, 0, 0
for i in range(n):
    t, x, y = map(int, input().split())
    if abs(x-X)+abs(y-Y) <= t-T and t % 2 == (x+y) % 2:
        continue
    else:
        print('No')
        quit()
    X, Y, T= x, y, T
print('Yes')
N = int(input())
t = 0
x = 0
y = 0
for ti, xi, yi in [map(int, input().split(' ')) for n in range(N)]:
    if not (xi-x+yi-y <= ti-t and (ti-t)%2 == (xi-x+yi-y)%2):
        print('No')
        exit()
    else:
        t = ti
        x = xi
        y = yi
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_)

for j in range(n):
  dt = t[j+1] - t[j]
  dx = x[j+1] - x[j]
  dy = y[j+1] - y[j]
  if dx+dy>dt or dt%2!=(dx+dy)%2:
    print('No')
    exit()
    
print('Yes')
n = int(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 - dist % 2:
        print("No")
        exit()

    x, y, t = dx, dy, dt
print("Yes")
N=int(input())
t=0
x=0
y=0
for i in range(N):
    t_next,x_next,y_next=map(int,input().split())
    zikan=t_next - t
    kyori=abs(x_next-x)+abs(y_next-y)
    if kyori>zikan or (zikan-kyori)%2==1:
        print('NO')
        exit(0)
    t,x,y=t_next,x_next,y_next
print('YES')
N=int(input())
t=[0]*100001
x=[0]*100001
y=[0]*100001

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

for i in range(1,N+1):
    dt=(t[i])-(t[i-1])
    dist=abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
    if dist>dt:
        break
    else:
        pass
    if dist%2==dt%2:
        pass
    else:
        break
    count+=1
if count==N:
    print('YES')
else:
    print('NO')
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[-1] < (x[-1]+y[-1]):
        print("No")
        exit()

print("Yes")
#!/usr/bin/env python3
# coding=utf-8

import sys

n = int(sys.stdin.readline().strip())

txy = [tuple(map(int, l.strip().split(" "))) for l in sys.stdin.readlines()]
check_txy = [abs(_x) + abs(_y) <= _t and (_t + _x + _y) % 2 == 0 for (_t, _x, _y) in txy]
if all(check_txy):
    print("Yes")
else:
    print("No")
A = []
N = int(input())
for _ in range(N):
    t,x,y = map(int,input().split())
    A.append(t-x-y)
for i in range(1,N):
    if A[i]%2!=A[i-1]%2:
        print('No')
        exit()
print('Yes')
n = int(input())
count=0
for i in range(0,n):
    t,x,y = map(int, input().split())
    if t>=x+y and (x+y-t)%2==0:
        count=count+1
if count==n:
    print("Yes")
else:
    print("No")
N = int(input())

loc = [0,0]
time = 0
for i in range(N):
  t,x,y = map(int,input().split())
  time = t-time
  dis = abs(loc[0]-x)+abs(loc[1]-y)
  if (time-dis)<0 :
    print("No")
    exit()
  if (time-dis)%2 == 1:
    print("No")
    exit()
    
  
  
  loc = [x,y]
    
  
else :
  print("Yes")
n = int(input())
a,b,c=0,0,0
for i in range(n):
    t,x,y = map(int, input().split())
    sa = t-a
    if sa<x+y:
        print("No")
        exit()
    else:
        tw = sa-x-y
        if tw%2!=0:
            print("No")
            exit()
print("Yes")
n = int(input())
txy = [list(map(int, input().split())) for i in range(n)]
t = 0
dx = 0
dy = 0
z = 'Yes'
for i,h,j in txy:
    if (dx != h or dy != j) and abs(dx-h)+abs(dy-j) <= i-t:
        dx = h
        dy = j
        t = i
    else:
        z = 'No'
print(z)
n = int(input())
for i in range(n):
  t, x, y = map(int, input().split())
  
    
  if t % 2 == 1:
    if (x + y) % 2 == 1 and x + y <= t:
      continue
    else:
      print('No')
      exit()
  else:
    if t % 4 == 0:
      if x == 0 and y == 0:
        continue
    elif (x + y) % 2 == 0 and x + y <= t:
      continue
    else:
      print('No')
      exit()
print('Yes')
N = int(input())
plan = [list(map(int, input().split())) for i in range(N)]
f = True
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 or dist%2 != time%2:
        f = False
        break       
print('Yes' if f else 'No')
n = int(input())

now = [0, 0]
time = 0

for i in range(n):
    array = list(map(int, input().split()))
    dist = abs(now[0] - array[1]) + abs(now[1] - array[2])
    time_diff = array[0] - time
    if time_diff < dist:
        print('No')
        exit()
    else:
        if dist%2 == time_diff%2:
            continue
        else:
            print('No')
            exit()
        time = array[0]

print('Yes')
num_list=int(input())
a=[1,0,0]
for i in range(num_list):
  b=[int(x) for x in input().split()]
  dt=(b[0]-a[0])
  d=(abs(b[1]-a[1])+abs(b[2]-a[2]))
  if d<=dt and d != 0 and (dt-d)%2==0:
    if i == num_list-1:
      print("Yes")
      break
    a=b
  else:
    print("No")
    break
N = int(input())

tprev = 0
xprev = 0
yprev = 0

result = 'YES'

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

    xlen = abs(x - xprev)
    ylen = abs(y - yprev)
    
    time = t - tprev

    length = xlen + ylen

    if time%2 == length%2 and time >= length:
        tprev = t
        xprev = x
        yprev = y

    else:
        result = 'NO'
        break
print(result)
n=int(input())
ans='Yes'
t,a,b=map(int,input().split())
if (a+b)<t or (a+b-t)%2==1:
  ans='No'
for i in range(n-1):
  u,x,y=map(int,input().split())
  if (u-t)<abs(x-a)+abs(y-b) or ((u-t)-abs(x-a)-abs(y-b))%2==1:
    ans='No'
    break
  t,a,b=u,x,y
print(ans)
def solve():
    N = int(input())
    t_i, x_i, y_i = map(int, input().split())
    for i in range(N-1):
        t_j, x_j, y_j = map(int, input().split())
        dt = t_j - t_i
        dxy = x_i + x_j - y_i - y_j
        if (dt > (t_j - t_i)) | (dt < (t_i - t_j)):
            return "No"
        if ((t_i - t_j) % 2) != (dxy % 2):
            return "No"
    return "Yes"


if __name__ == "__main__":
    print(solve())
N = int(input())

pos_x=0
pos_y=0
t_now=0
flg = True
for i in range(N):
    t,x,y = map(int,input().split())
    t_del = t-t_now
    res = (t_del-abs(pos_x-x)-abs(pos_y-y))
    if (res>=0) & (res%2==0):
        t_now = t
        x_pos = x
        y_pos=y
        pass
    else:
        flg = False
        break

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

bt, bx, by = 0, 0, 0
flg = True

for i in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x-bx)+abs(y-by)
    time = t-bt
    if time<dist and time%2!=dist%2:
        flg = False
        break
    else:
        bt, bx, xy = t, x, y

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

count = 0
t_pre, x_pre, y_pre = 0, 0, 0

for i in range(N):
    t, x, y = map(int, input().split())
    
    if (abs(x - x_pre) + abs(y - y_pre) <= t - t_pre) and t%2 == (x + y)%2 :
        print('Yes')

    else:
        print('No')
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())

for i in range(N):
 t,x,y=list(map(int,input().split()))
 a=[(x+y)%2]
 b=[t%2]

if a==b and (x+y)<=t:
  print("Yes")
else :
  print("No")
n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]
print(txy[0])

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

tp = 0
xp = 0
yp = 0
flag = 0
for i in range(n):
  t, x, y = map(int,input().split())
  dt = t-tp
  dx = abs(xp-x)
  dy = abs(yp-y)
  if dx+dy==dt:
    flag=1
  elif dt%2==0 and dx%2==0 and dy%2==0:
    flag=1
  elif dt%2==0 and dx%2==1 and dy%2==1:
    flag=1
  elif dt%2==1 and dx%2==0 and dy%2==1:
    flag=1
  elif dt%2==1 and dx%2==1 and dy%2==0:
    flag=1
  tp=t
  xp=x
  yp=y

if flag==1:
  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_)
    if T >= manhattan_dist and manhattan_dist%2 == T%2:
        pass
    else:
        ans='No'

print(ans)
N=int(input())
txy=[list(map(int,input().split())) for _ in range(N)]
txy.insert(0,[0,0,0])
answer="Yes"

for i,t in enumerate(txy):
    if i>=1:
        base=abs(t[1]-txy[i-1][0])+abs(t[2]-txy[i-1][2])
        time=t[0]-txy[i-1][0]
        if base<=time and (time-base)%2==0:
            pass
        else:
            answer="No"
            break
print(answer)
n = int(input())
for i in range(n):
 t,x,y = map(int,input().split())
 if (x+y) > t or (x+y)%2==t%2:
  print("No")
  exit()
print("Yes")
N=int(input())
flag='Yes'
p,q,r=0,0,0
for _ in range(N):
  t,x,y=map(int,input().split())
  a=x+y-p-q
  t=t-r
  if a<=t:
    if (t-a)%2!=0:
      flag='No'
      break
  else:
    flag='No'
    break
  p=x
  q=y
  r=t
print(flag)
N = int(input())
A = [[int(x) for x in input().split()]for i in range(N)]
T = 0            ####現在時刻
place = (0,0)    ####現在地
for i in range(N):
  if ((A[i][0]-T) + abs(A[i][1]-place[0]) + abs(A[i][2]-place[1]))%2 == 0:
    T = A[i][0]
    place = (A[i][1], A[i][2])
  else:
    print("No")
    exit()
print("Yes")
def check(dest,start):
    tmp = dest[1] - start[1] + dest[2] - start[2] - (dest[0] - start[0])
    if tmp <= 0 and tmp%2 == 0 :
        return True
    else:
        return False

n = int(input())
start = [0,0,0]
for i in range(n):
    dest = list(map(int, input().split()))
    if check(dest,start):
        start = dest
    else:
        print("No")
        exit()

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

x, y = 0, 0
for i in range(N):
    t1 = T[i][0]
    x1 = T[i][1]
    y1 = T[i][2]
    if t1 < abs(x1 - x) + abs(y1 - y):
        print('No')
        sys.exit()
    t1 -= abs(x1 - x) + abs(y1 - y)
    if t1 % 2 != 0:
        print('No')
        sys.exit()
print('Yes')
N = int(input())
L = [list(map(int, input().split())) for i in range(N)]

l = [[0, 0, 0]]
l.extend(L)

flag = True
for c in range(1, len(L)):
    dt = l[c][0] - l[c-1][0]
    dist = abs(l[c][1] - l[c-1][1]) + abs(l[c][2] - l[c-1][2])

    if dist > dt or dist % 2 != dt % 2:
        flag = False

print("Yes" if flag else "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 = False
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

    reachable = True if p - p_pre == move else False

    t_pre, x_pre, y_pre = t, x, y

print("Yes" if reachable == True else "No")
N=int(input())
L=[[0,0,0]]
for i in range(N):
  L.append(list(map(int,input().split())))

s=0
for i in range(1,N+1):
  if abs(L[i][1]-L[i-1][1])+abs(L[i][2]-L[i-1][2]) > L[i][0]-L[i-1][0]:
    s=1
    break

print("Yes" if s==0 else "No")
n = int(input())
flag = True
for _ in range(n):
    t, x, y = map(int, input().split())
    if t < x + y or (x + y + t) % 2:
        flag = False

print("Yes" if flag else "No")
N = int(input())
xy=[]
try :
  while True:
    t = input().split()
    t = list(map(int,t))
    xy.append(t)
except EOFError:
  pass
loc = [0,0]
time = 0
for i in range(N):
  a = xy[i]
  time = a[0]-time
  dis = abs(loc[0]-a[1])+abs(loc[1]-a[2])
  if (time-dis)<0 :
    print("No")
    break
  elif (time-dis)%2 == 0:
    pass
    
  else :
    print("No")
    break
  loc = [a[1],a[2]]
else :
  print("Yes")
time = int(input())
jorney = [list(map(int,input().split())) for i in range(time)]
flg = True
for point in jorney:
    time = point[0]
    x = point[1]
    y = point[2]
    if time %2 == (x+y)%2 and time>= x+y:
        continue
    else:
        flg=False
        break
if flg:
    print("YES")
else:
    print("NO")
N=int(input())
pre_t=0
pre_x=0
pre_y=0
flg=0
for i in range(N-1):
    t,x,y=map(int,input().split())
    t_tmp = t
    t=t-pre_t
    dist=abs(x-pre_x) + abs(y - pre_y)
    pre_t=t_tmp
    pre_x=x
    pre_y=y
    if(dist >= t ):
        flg=1
        break
    if((dist)%2 != t%2):
        flg=1
        break
if(flg == 0):
    print("Yes")
else:
    print("No")
N = int(input())

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

x0 = 0
y0 = 0
t0 = 0
res = "Yes"
for t, x, y in pairs:
    dx = x - x0
    dy = y - y0

    if dx + dy != t - t0:
        tmp = t - t0 - (dx + dy)
        if tmp < 0 or tmp % 2 != 0:
            res = "No"
            break
    x0 += x
    y0 += y
    t0 += t

print(res)
N = int(input())
now = [0,0]
tnow = 0
ans = 'Yes'
for i in range(N):
    t,x,y = map(int,input().split())
    dis = abs(x-now[0]) + abs(y-now[1])
    if t-tnow < dis:
        ans = 'No'
        break
    tnow = t
    now = [x,y]
print(ans)
# -*- 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())
x = 0
y = 0
t = 0
c = []

for i in range(n):
    c.append(list(map(int,input().split())))

for i in range(n):
    t = c[i][0] - t
    a = c[i][1]
    b = c[i][2]

    if (t - abs((x+y) - (a+b))) %2 == 0 and abs((x+y) - (a+b)) <= t:
        x = a
        y = b
    else:
        print("No")
        exit()

print("Yes")
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 += x[i+1]-x[i]
    y_diff += y[i+1]-y[i]
    if t_diff%2 != (x_diff+y_diff)%2 or t[-1] < (x[-1]+y[-1]):
        print("No")
        exit()

print("Yes")
# 2020/03/14
# AtCoder Beginner Contest 086 - C

# Input
n = int(input())
nx = 0
ny = 0
nt = 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 - nt) or (dist <= (t - nt) and dist % 2 == 0):
        ans = "No"
        break
    nx = x
    ny = y
    nt = t

# Output
print(ans)
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 != 0 and dt % 2 != 0:
        flag = flag +1
else:
    print("Yes" if flag ==0 else "No")
N = int(input())
Sorted = [list(map(int, input().split())) for _ in range(N)]
Sorted.insert(0, [0, 0, 0])

for i in range(N):
  if abs(Sorted[i+1][1] - Sorted[i][1]) + abs(Sorted[i+1][2] - Sorted[i][2]) > Sorted[i+1][0] - Sorted[i][0]:
    print("No")
    break
  elif abs(Sorted[i+1][1] - Sorted[i][1]) == 0 and abs(Sorted[i+1][2] - Sorted[i][2]) == 0:
    print("No")
    break
else:
  print("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) | (dist % 2 != dt % 2):
    can = "NO"
print(can)