peterverebics/CodeNet_Python_118 huggingface dataset:
n = int(input())

T = [0]
X = [0]
Y = [0]

judge = 'Yes'

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(1, n+1):
    delt_t = T[i] - T[i-1]
    t_parity = delt_t % 2
    d = abs(X[i] - X[i -1]) + abs(Y[i] - Y[i - 1])
    d_parity = d % 2
    if delt_t >= d and t_parity == d_parity:
        continue
    else:
        judge = 'No'
        break

print(judge)
n = int(input())
travel_list = [[0,0,0]]
for i in range(n):
    travel_list.append([int(num) for num in input().split(" ")])
for i in range(1,n+1):
    t_step = travel_list[i][0]-travel_list[i-1][0]
    x_step = abs(travel_list[i][1]-travel_list[i-1][1])
    y_step = abs(travel_list[i][2]-travel_list[i-1][2])
    if x_step+y_step>t_step:
        print("No")
        exit()
    elif (t_step - (x_step + y_step))%2==1:
        print("No")
        exit()
print("Yes")
n = int(input())
prev_dst = 0
prev_time = 0
for _ in range(n):
    t, x, y = map(int, input().split())
    total = x + y
    if t % 2 != total % 2 or (t - prev_time) < abs(total - prev_dst):
        print('No')
        exit()
    prev_time = t
    prev_dst = total
print('Yes')
n = int(input())
l = [list(map(int, input().split())) for l in range(n)]
for i in l:
  if i[1] + i[2] > i[0] 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):
  t_,x_,y_=map(int,input().split())
  t=abs(t_-t)
  x=abs(x_-x)
  y=abs(y_-y)
  if x+y>t:
    print('No')
    exit()
  if t_%2!=(x_+y_)%2:
    print('No')
    exit()
  
print('Yes')
N=int(input())
T,X,Y=0,0,0
ans=True
for i in range(N):
  t,x,y=map(int,input().split())
  dt,dx,dy=t-T,abs(X-x),abs(Y-y)
  if dt<dx+dy:
    ans=False
    # print(1)
  if dt%2!=(dx+dy)%2:
    ans=False
    # print(2)
  T,X,Y=t,x,y
print('Yes' if ans else 'No')
N = int(input())
T, X, Y = 0, 0, 0
for i in range(N):
    t, x, y = map(int, input().split())
    dt = abs(T-t)
    dist = abs(X-x) + abs(Y-y)
    if dt < dist or dist % 2 != dt % 2:
        print("No")
        exit()
print("Yes")
n = int(input())
txy = [list(map(int, input().split())) for i in range(n)]
for i in txy:
    if i[1] + i[2] > i[0] 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):
    a,b,c = list(map(int,input().split()))
    t.append(a)
    x.append(b)
    y.append(c)

flag = True
for i in range(1,n+1):

    if (t[i]-t[i-1])%2 != (abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))%2 or (abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))>t[i]-t[i-1]:
        flag = False


if flag:
    print("Yes")
else:
    print("No")
N = int(input())
now = (0,0,0)
for i in range(N):
    bx,by,bt = now
    t,x,y = map(int,input().split())
    if abs(x-bx)+abs(y-by) <= t-bt and (abs(x-bx)+abs(y-by))%2 == (t-bt)%2:
        now = (x,y,t)
        continue
    else:
        print("No")
        break
else:
    print("Yes")
N=int(input())
count=0
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 and t%2==(x+y)%2:count+=1
    T,X,Y=t,x,y
print("Yes" if count==N else "No")
n = int(input())
t = 0
x = 0
y = 0
judge = True

for i in range(n):
    t1, x1, y1 = map(int, input().split())
    if (abs(x1 - x) + abs(y1 - y))/(t1 - t) > 1 or (abs(x1 - x) + abs(y1 - y))%2 != (t1 - t)%2:
        judge = False
    x = x1
    y = y1
    t = t1

if judge == True:
    print("Yes")
else:
    print("No")
from sys import stdin
input = stdin.readline

N = int(input())
x1,y1,t1 = 0,0,0
for _ in range(N):
    t2,x2,y2 = map(int, input().split())
    X, Y, T = abs(x2 - x1), abs(y2 - y1), t2 - t1
    if X + Y > T or (T - X - Y) % 2 == 1:
        print('No')
        exit()
    x1, y1, t1 = x2, y2, t2
print('Yes')
N = int(input())
T = []
XY = []
ans = "Yes"

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

if T[0]>=abs(XY[0][0])+abs(XY[0][1]) and T[0]%2==(abs(XY[0][0])+abs(XY[0][1]))%2:
  None
else:
  ans = "No"

for i in range(1,N):
  dT=T[i]-T[i-1]
  dX=abs(XY[i][0]-XY[i-1][0])
  dY=abs(XY[i][1]-XY[i-1][1])
  if dT >= dX+dY and dT%2 == (dX+dY)%2:
    None
  else:
    ans = "No"

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)+abs(c-z))%2==abs(a-x)%2:
        pass
    else:
        flag=False
        break
if flag:
    print("Yes")
else:
    print("No")
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
x = 0
y = 0
t = 0
for i in range(n):
    if abs(a[i][1] - x) + abs(a[i][2] - y) > abs(a[i][0] - t) or (a[i][1] - x + a[i][2] - y) % 2 != (a[i][0] - t) % 2:
        print('No')
        break
    else:
        x = a[i][1]
        y = a[i][2]
        t = a[i][0]
else:
    print('Yes')
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())
s = [[0,0,0]]
flag = 0
for i in range(n):
    t, x, y = map(int, input().split())
    s.append([t,x,y])
# print(s)
for i in range(1,n+1):
    dt = s[i][0]-s[i-1][0]
    dx = abs(s[i][1]-s[i-1][1])
    dy = abs(s[i][2]-s[i-1][2])
#     print(dt,dx,dy)
    if dt - (dx+dy) >= 0 and dt % 2 == (dx+dy) % 2:
        continue
    else:
        flag = 1
        print('No')
        break
if flag == 0:
    print('Yes')
import math
n = int(input())
#P position t time
P = [0,0]
t0 = 0
for _ in range(n):
  t,x,y = map(int, input().split( ))
  dt = t - t0
  dis = abs(x - P[0])  + abs(y - P[1])
  if dis > dt:
    print('No')
    exit()
  elif (dt - dis)%2 == 1:
    print('No')
    exit()
  t0 = t
  P = [x,y]
print('Yes')
N = int(input())

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


def solve():
    former = [0,0,0]
    for a in Z:
        distance = abs(a[1]-former[1])+abs(a[2]-former[2])
        if distance > a[0] - former[0]:
            print("No")
            return
        if (a[0]-former[0]) % 2 != distance % 2:
            print("No")
            return
        former = a
    print("Yes")

solve()
n = int(input())

x_now, y_now, t_now = 0, 0, 0

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

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

p=[0,0]
time=0
for i in range(N):
    t,x,y=map(int,input().split())
    cost=abs(x-p[0])+abs(y-p[1])
    if t<time+cost:
        print("No")
        exit()
    else:
        if (t-time-cost)%2!=0:
            print("No")
            exit()
        else:
            p=[x,y]
            time=t
print("Yes")
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())
    
yn=""
for i in range(n):
    ti=t[i+1]-t[i]
    d=abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
    if d>ti or ti%2!=d%2:
        yn="No"
        break
    
if yn=="No":
    print("No")
else:
    print("Yes")
def check(dest,start):
    ll = dest[1] - start[1] + dest[2]-start[2]
    if ll < 0:
        ll = -ll
    time = dest[0] - start[0]
    tmp = ll - time
    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")
# -*- coding: utf-8 -*-
n = int(input())
t_now = 0
pos = [0,0]
l = [list(map(int, input().split())) for _ in range(n)]

for t, x, y in l:
    t_d = t - t_now
    range_move = list(range(-t_d, t_d+1, 2))

    pos_d = (x-pos[0]) + (y-pos[1])

    if pos_d in range_move:
        t_now = t
        pos = [x, y]
    else:
        print('No')
        exit()

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

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

can="Yes"
for i in range(n):
    kyori=abs(a[i+1][1]-a[i][1]) + abs(a[i+1][2]-a[i][2])
    dt=a[i+1][0] - a[i][0]
    if dt < kyori:
        can="No"
        break
    if dt%2 != kyori%2:
        can="No"
        break
print(can)
N = int(input())
S = [[0, 0, 0]]
S.extend([list(map(int, input().split())) for i in range(N)])

for i in range(N):
    t = abs(S[i][0] - S[i + 1][0])
    d = abs(S[i][1] - S[i + 1][1]) + abs(S[i][2] - S[i + 1][2])
    if t < d:
        print("No")
        exit()
    if t % 2 != d % 2:
        print("No")
        exit()

print("Yes")
N = int(input())
t, x, y = [0]*3
for _ in range(N):
  t_, x_, y_ = map(int, input().split())
  dis = abs(x_ - x) + abs(y_ - y)
  dt = t_ - t
  if dis > dt:
    print("No")
    exit()
  if dis%2 == dt%2:
    t, x, y = t_, x_, y_
  else:
    print("No")
    exit()
print("Yes")
n = int(input())
l = [list(map(int,input().split())) for _ in range(n)]

x = 0
y = 0
for i in range(n):
    t = l[i][0]
    x = l[i][1]
    y = l[i][2]
    d = x + y
    if d <= t and (d - t) % 2 == 0:
        continue
    else:
        print('No')
        quit()
print('Yes')
N=int(input())
last_t,last_x,last_y=0,0,0
for _ in range(N):
    t,x,y = map(int,input().split())
    move = abs(x-last_x)+abs(y-last_y)
    time = t - last_t
    if (time >= move) and (time - move) % 2 == 0:
        last_t,last_x,last_y=t,x,y
    else:
        print("No")
        break
else:
    print("Yes")
# 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 and (dt - (dx + dy)) % 2 == 0:
        t, x, y = ti, xi, yi
    else:
        ans = "No"
        break
print(ans)
n=int(input())
T,X,Y=0,0,0

a='Yes'
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:
        a='No'
        break
    T,X,Y=t,x,y
print('{}'.format(a))
n=int(input())
pt,px,py=0,0,0
for _ in range(n):
    t,x,y=map(int,input().split())
    if t-pt<abs(x-px)+abs(y-py) or (t-pt)%2!=(abs(x-px)+abs(y-py))%2:
        print("No")
        exit()
    pt=t
    px=x
    py=y
print("Yes")
N=int(input())
t=[]
x=[]
y=[]
flag=False
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):
    t[i]=t[i]-t[i-1]
    x[i]=x[i]-x[i-1]
    y[i]=y[i]-y[i-1]

for i in range(N):
  if((x[i]+y[i])%2==t[i]%2 and abs(x[i])+abs(y[i])<=t[i]):
    flag=True
  else:
    flag=False
    break

if(flag):
  print("Yes")
else:
  print("No")
n = int(input())
prev_dst = 0
prev_time = 0
for _ in range(n):
    t, x, y = map(int, input().split())
    if t % 2 == 0 and (x + y) % 2 != 0:
        print('No')
        exit()
    if t % 2 == 1 and (x + y) % 2 != 1:
        print('No')
        exit()
    if (t - prev_time) < abs(x + y - prev_dst):
        print('No')
        exit()
    prev_time = t
    prev_dst = x + y
print('Yes')
n = int(input())
input_line = [list(map(int,input().split())) for i in range(n)]
time=0
point = [0,0]

ans=1
for i in range(n):
    t,x,y = map(int,input_line[i])
    dist = abs(point[0]-x)+abs(point[1]-y)
    limit = t-time
    if dist>limit:
        ans=0
        break
    if (limit-dist)%2!=0:
        ans=0
        break
    time=t
    point=[x,y]
print('Yes' if ans==1 else 'No')
N = int(input())
t, x, y = 0, 0, 0
ans = 'Yes'
for _ in range(N):
    tn, xn, yn = map(int, input().split())
    d = abs(xn - x) + abs(yn - y)
    td = tn - t
    if d > td or (d - td)%2 != 0:
        ans = 'No'
    t, x, y = tn, xn, yn
print(ans)
N=int(input())
flag='Yes'
p,q,r=0,0,0
for _ in range(N):
  t,x,y=map(int,input().split())
  a=abs(x-p)+abs(y-q)
  e=t-r
  if a<=e:
    if (e-a)%2!=0:
      flag='No'
      break
  else:
    flag='No'
    break
  p,q,r=x,y,t
print(flag)
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())

T = 0
X = 0
Y = 0

for i in range(N):
    t, x, y = map(int, input().split())
    dt = t - T
    dx = abs(X - x)
    dy = abs(Y - y)
    dis = dx + dy
    if dt < dis:
        print("No")
        break
    if (dt - dis) % 2 == 1:
        print("No")
        break
    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(1, N + 1):
    t[i], x[i], y[i] = map(int, input().split())

for i in range(1, N + 1):
    t_dif = t[i] - t[i - 1]
    dict = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1])
    #print(t_dif, dict)
    if t_dif < dict or t_dif % 2 != dict % 2:
        print("No")
        break
else:
    print("Yes")
N=(int)(input())
t_=0
x_=0
y_=0
for i in range(N):
    st,sx,sy = input().split()
    t=(int)(st)
    x=(int)(sx)
    y=(int)(sy)
    dt = t-t_
    dx = x-x_
    dy = y-y_
    if dx+dy>dt or (dx+dy)%2!=dt%2:
        print("No")
        exit(0)
    
print("Yes")
N = int(input())
T = [[0, 0]]
for _ in range(N):
    t, x, y = map(int, input().split())
    T.append((t, x + y))

for i in range(N):
    dt = T[i+1][0] - T[i][0]
    dxy = abs(T[i+1][1] - T[i][1])

    if dt < dxy or dt % 2 != dxy % 2:
        print("No")
        break
else:
    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')
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
prev_x = prev_y = prev_t = 0

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

    time = t - prev_t
    dist = abs(x - prev_x) + abs(y - prev_y)

    if dist > time or dist % 2 != time % 2:
        print("No")
        break

    prev_x, prev_y, prev_t = x, y, t

else:
    print('Yes')
n=int(input())
a=[list(map(int,input().split())) for _ in range(n)]
x=y=t=0
ans='Yes'
for i in range(n):
  xy=a[i][1]+a[i][2]-(x+y)
  if xy>a[i][0]-t:
    ans='No'
    break
  else:
    if xy%2!=(a[i][0]-t)%2:
      ans='No'
      break
    elif abs(a[i][1]-x)+abs(a[i][2]-y)>a[i][0]-t:
      ans='No'
      break
  x=a[i][1]
  y=a[i][2]
  t=a[i][0]
print(ans)
N = int(input())
T = [];X = [];Y = []
for _ in range(N):
    t,x,y = map(int, input().split())
    T.append(t)
    X.append(x)
    Y.append(y)
if N == 1:
    print('Yes' if T[0] == sum(X+Y) else 'No')
    exit()
for i in range(N):
    if i == 0: continue
    d = abs(X[i] + Y[i] - X[i-1] - Y[i-1])
    t = T[i] - T[i-1]
    if (t + d) % 2 or t < d:
        print('No')
        exit()
else:
    print('Yes')
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 = abs(int(A[i][1]) - int(A[i -1][1]))
  V = abs(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())

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")
n = int(input())
count = 0
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) <= abs(T-t) and t%2==(x+y)%2:
        count += 1
    T,X,Y = t,x,y
print("Yes" if count==n else "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
    dt = t - t0

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

print(res)
import sys
n = int(input())
pret = 0
prex = 0
prey = 0
for i in range(n):
    t,x,y = map(int,input().split())
    tmp = t - pret - abs(x - prex) - abs(y - prey)
    #print(t, x, y, tmp)
    if tmp >= 0 and tmp % 2 == 0:
        pret = t
        prex = x
        prey = y
    else:
        print('No')
        sys.exit()
print('Yes')
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))%2 == 1 or (t - T) < abs(x-X) + abs(y-Y):
        print("No")
        break
else:
    print("Yes")
# C - Traveling
def can_travel(N):

	last_t, last_x, last_y = 0, 0, 0
	
	for i in range(N):
		t, x, y = map(int, input().split())
		distnace = abs(x - last_x) + abs(y - last_y)
		time = t - last_t
		
		if distnace > time:
			return False
		elif (time - distnace) % 2 == 1:
			return False
	
	return  True
		

N = int(input())

if can_travel(N):
	print('Yes')
else:
	print('No')
n=int(input())
x,y=0,0
t=0
for i in range(n):
    T,X,Y=map(int,input().split())
    if((T-t)>=(abs(X-x)+abs(Y-y)) and (T-t)%2==(abs(x-X)+abs(Y-y))%2):
        x=X
        y=Y
        t=T
    else:
        print("No")
        exit()
print("Yes")
import sys
N = int(input())
t_param = 0
x_param = 0
y_param = 0

for i in range(N):
    t, x, y = map(int, input().split())
    if (abs(x - x_param) + abs(y - y_param))  > (abs(t - t_param)) or ((x + y + t)%2) != 0 :
        print('No')
        sys.exit()
    t_param = t
    x_param = x
    y_param = y
print('Yes')
ans = 'Yes'
n = int(input())
for _ in range(n):
    t, x, y = map(int, input().split())
    if t < x + y:
        ans = 'No'
        break
    if  t % 2 != 0 and (x - y) % 2 == 0:
        ans = 'No'
        break
    elif t % 2 == 0 and (x - y) % 2 != 0:
        ans = 'No'
        break

print(ans)
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 and num%2 == su%2:
    ans="Yes"
  else:
    ans="No"
    break
      
print(ans)
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 - t - dist) % 2:
        print("No")
        exit()

    x, y, t = dx, dy, dt
print("Yes")
def main():
    import sys
    input = sys.stdin.readline

    N = int(input())

    pt, px, py = 0, 0, 0
    for _ in range(N):
        t, x, y = map(int, input().split())
        dt = t - pt
        dx = abs(x - px)
        dy = abs(y - py)
        dl = dx + dy

        if dt < dl or dl % 2 != dt % 2:
            print('No')
            return

        pt, px, py = t, x, y

    print('Yes')


if __name__ == '__main__':
    main()
import sys
input = sys.stdin.readline

n = int(input())

bt, bx, by = 0, 0, 0
cond = True
for i in range(n):
    t, x, y = [int(w) for w in input().split()]
    dt = t-bt
    dist = abs(bx-x)+abs(by-y)
    if dt >= dist and (dt-dist) % 2 == 0:
        bt, bx, by = t, x, y
        continue
    cond = False


print("Yes" if cond else "No")
N = int(input())
t = [list(map(int,input().split())) for _ in range(N)]
for i in range(N):
    if (
           (t[i][0] % 2 == 0 and ((t[i][1]+t[i][2]) % 2 != 0 or (abs(t[i][1])+abs(t[i][2])) > t[i][0]))
        or (t[i][0] % 2 == 1 and ((t[i][1]+t[i][2]) % 2 != 1 or (abs(t[i][1])+abs(t[i][2])) > t[i][0]))
        ):
        print('No')
        break
else:
    print('Yes')
N = int(input())
l = [[] for _ in range(N)]
for i in range(N):
    l[i] = list(map(int,(input().split())))
l.append([0,0,0])
for i in range(N):
    dt = l[i][0] - l[i-1][0] 
    dx = abs(l[i][1] - l[i-1][1])
    dy = abs(l[i][2] - l[i-1][2])
    d = dx + dy
    if d > dt:
        print("No")
        break
    else:
        if (d-dt)%2 == 1:
            print("No")
            break
else:
    print("Yes")
#086_C
n = int(input())
txy =[(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(n)]

flg = True
for i in range(n):
    ti, xi, yi = txy[i]
    tj, xj, yj = txy[i+1]
    if abs(xj-xi) + abs(yj-yi) > tj - ti:
        flg = False
        break
    elif (tj - ti - abs(xj-xi) - abs(yj-yi)) % 2:
        flg = False
        break
print('Yes' if flg else 'No')
N = int(input())
T = [[0,0,0]]+[ [int(x) for x in 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)
I = int(input())

pt = px = py = 0
for i in range(I):
    t, x, y = map(int, input().split())

    costtime = abs(t - pt)
    distance = abs(x - px) + abs(y - py)

    if costtime%2 != distance%2:
        print("No")
        exit()

    if costtime < distance:
        print("No")
        exit()

    pt,px,py = t,x,y

print("Yes")
n = int(input())
time = 0
here = [0,0]
for i in range(n):
    t,x,y = map(int,input().split())
    if t - time < abs(x-here[0])+abs(y-here[1]):
        print("No")
        exit()
    if (t-time) % 2 != (abs(x-here[0])+abs(y-here[1]))%2:
        print("No")
        exit()
    time = t
    here = [x,y]
print("Yes")
N = int(input())
t = [0]
x = [0]
y = [0]
for _ in range(N):
    a, b, c = map(int, input().split())
    t.append(a)
    x.append(b)
    y.append(c)

for i in range(1, N+1):
    dist = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1])
    time = t[i] - t[i-1]
    # print(time, dist)
    if time >= dist and (dist - time) % 2 == 0:
        continue
    else:
        print('No')
        exit()

print('Yes')
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[1::]):
    dist=abs(t[1]-txy[i][1])+abs(t[2]-txy[i][2])
    time=t[0]-txy[i][0]
    if dist<=time and (time-dist)%2==0:
        pass
    else:
        answer="No"
        break
print(answer)
import sys
N = int(input())
T = []
for _ in range(N):
	T.append(list(map(int,input().split())))

#--------------------------------------------
now = [0,0]
now_time = 0
for i in range(N):
  left_time = T[i][0] - now_time
  target = [T[i][1],T[i][2]]
  distance = abs(T[i][1]-now[0]) + abs(T[i][2]-now[1])
  if distance <= left_time and distance % 2 == left_time % 2:
    now_time = T[i][0]
    now = target
    
  else:
    print("No")
    sys.exit()

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
f=True
for i in range(1,N+1):
  t=a[i-1][0]-dp[i-1][1]
  x=a[i-1][1]
  y=a[i-1][2]
  if t>=x+y-dp[i-1][0] and t%2==(x+y+dp[i-1][1])%2:
    dp[i][0]=x+y
    dp[i][1]=a[i-1][0]
  else:
    f=False
    break
if f:print("Yes")
else:print("No")
n = int(input())

a, b = 0, 0
c = 0
ans = 0
for i in range(n):
    t, x, y = map(int, input().split())
    if (t - c) % 2 == (abs(x - a) + abs(y - b)) % 2 and abs(x - a) + abs(y - b) <= t - c:
        continue
    else:
        ans = 1
if ans == 0:
    print("Yes")
else:
    print("No")
N = int(input())

t = 0
x = 0
y = 0
flag = True
for _ in range(N):
    tn, xn, yn = map(int, input().split())
    dt = tn - t
    l1 = abs(xn - x) + abs(yn - y)
    if (l1 <= dt) and (tn % 2 == (xn + yn) % 2):
        continue
    else:
        flag = False
        break

if flag:
    print('Yes')
else:
    print('No')
N=int(input())
T=[]
X=[]
Y=[]
for i in range(N):
    t,x,y=map(int,input().split())
    T.append(t)
    X.append(x)
    Y.append(y)
count=0
t,x,y=0,0,0
for i in range(N):
    # |x-X|+|y-Y|<=t-T
    # t%2=(x+y)%2
    if abs(X[i]-x)+abs(Y[i]-y)<=T[i]-t and T[i]%2==(X[i]+Y[i])%2:
        count+=1
    t,x,y=T[i],X[i],Y[i]
if count==N:
    print('Yes')
else:
    print('No')