peterverebics/CodeNet_Python_118 huggingface dataset:
n = int(input())
nowx = 0
nowy = 0
nowt = 0

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

for i in range(n):
    nextt, nextx, nexty = map(int,input().split())
    if (nextt - nowt) >= manhattan(nowx,nowy,nextx,nexty) and (nextt - nowt)%2 == manhattan(nowx,nowy,nextx,nexty)%2:
        nowx, nowy, nowt = nextx, nexty, nextt
    else:
        print('No')
        exit()
print('Yes')
import sys
n=int(input())
currtime=0
currx=0
curry=0
for i in range(n):
  t,x,y=map(int,input().split())
  if abs(y-curry)+abs(x-currx)<=t-currtime and (abs(y-curry)+abs(x-currx))%2==(t-currtime)%2:
    currx=x
    curry=y
    currtime=t
  else:
    print('No')
    sys.exit()
print('Yes')
import sys
# -*- coding: utf-8 -*-
# 	入力
n=int(input())
t=0
x=0
y=0
s="Yes"
for i in range(n):
  t1,x1,y1=map(int,sys.stdin.readline().split())
  if abs(x1-x)+abs(y1-y) > (t1-t):
    s="No"
    break
  if ((x1 + y1) % 2) == (t1 % 2):
    x=x1
    y=y1
    t=t1
  else:
    s="No"
    break
# 出力
print(s)
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(1,n+1):
    dt = t[i] - t[i-1]
    dx = x[i] - x[i-1]
    dy = y[i] - y[i-1]
    if abs(dx) + abs(dy) > dt or (dx+dy) % 2 != 0 and dt % 2 == 0 or (dx+dy) % 2 == 0 and dt % 2 != 0:
        break

else:
    print("Yes")
    exit()
print("No")
n = int(input())
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 dx +dy <= dt and (dt -dx-dy)%2 ==0:
    continue
  else:
    print('No')
    break
else:
  print('Yes')
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 21 23:53:42 2020

@author: liang
"""

N = int(input())

prev = (0, 0, 0)

flag = True

for i in range(N):
    t, x, y = map(int, input().split())
    if t%2 != (x+y)%2:
        flag = False
    if abs(x+y - prev[1] - prev[2]) > t-prev[0]:
        flag = False
    prev = (t,x,y)

if flag:
    print("Yes")
else:
    print("No")
n=int(input())
l=[[0,0,0]]
for _ in range(n):
    l.append(list(map(int,input().split())))

for i in range(1,n+1):
    k=abs(l[i][1]-l[i-1][1])+abs(l[i][2]-l[i-1][2])
    t=l[i][0]-l[i-1][0]
    if k>t or k%2!=t%2:
        print("No")
        exit()
print("Yes")
n = int(input())
for i in range(n):
    t,x,y = map(int,input().split())
    if (x+y) <= t and (x+y+t) % 2 == 0:
        continue
    else:
        break
else:
    print("Yes")
    quit()
print("No")
n = int(input())
TXY = []
tc, xc, yc = 0, 0, 0
for i in range(n):
    t, x, y = map(int, input().split())
    d = abs(x-xc)+abs(y-yc)
    if d > t-tc or (t-tc-d)%2 == 1:
        print('No')
        exit()
    else:
        tc, xc, yc = t, x, y
else:
    print('Yes')
n=int(input())
a=[[int(i) for i in input().split()]for i in range(n)]

time=0
sum_xy=0
for t,x,y in a:
    if t-time<abs(sum_xy-(x+y)) or (t-time)%2!=(sum_xy-(x+y))%2:
        print('No')
        exit()
    time=t
    sum_xy=x+y
print('Yes')
t = [0]
x = [0]
y = [0]
n = int(input())
for i in range(n):
    ti, xi, yi = map(int, input().split())
    t.append(ti)
    x.append(xi)
    y.append(yi)
    
flg=True
for i in range(1, n+1):
    if((x[i]-x[i-1])+(y[i]-y[i-1])>(t[i]-t[i-1])):
        flg=False
    elif(((x[i]-x[i-1])+(y[i]-y[i-1]))%2!=(t[i]-t[i-1])%2):
        flg=False
if(flg):
    print("Yes")
else:
    print("No")
N = int(input())

T = []
X = []
Y = []
T.append(0)
X.append(0)
Y.append(0)

for _ 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, 1):
    dt = T[i]-T[i-1]
    dl = abs((X[i]+Y[i])-(X[i-1]+Y[i-1]))
    if dt<dl:
        print("No")
        exit()
    if dt%2!=dl%2:
        print("No")
        exit()
print("Yes")
# ABC086 C Traveling

n = int(input())
t, x, y = 0, 0, 0
flag = True

for i in range(n):
    _t,_x,_y = map(int, input().split())
    _d = abs(x - _x) + abs(y - _y)
    _dt = abs(t - _t)
    if _d > _dt or ((_d - _dt)%2) == 1:
        flag = False
    t,x,y = _t,_x,_y

if flag:
    print("Yes")
else:
    print("No")
n = int(input())
nt, nx, ny = 0, 0, 0
for i in range(n):
    t, x, y = map(int, input().split())
    now = t-nt
    location = abs(nx-x) + abs(ny-y)
    if location <= now and (now-location)%2 == 0:
        nt, nx, ny = t, x, y
    else:
        print('No')
        exit()
print('Yes')
n = int(input())
t = [0]
x = [0]
y = [0]
for i in range(n):
    tt, xx, yy = map(int, input().split(" "))
    t.append(tt)
    x.append(xx)
    y.append(yy)

ans = "Yes"
for i in range(n):
    dt = t[i+1] - t[i]
    ddis = abs(x[i + 1] + y[i + 1] - (x[i] + y[i]))
    if not (ddis <= dt and ((dt % 2 == 0 and ddis % 2 == 0) or (dt % 2 == 1 and ddis % 2 == 1))):
        ans = "No"
        break

print(ans)
n=int(input())

z=0
for i in range(n):
    t,x,y= map(int,input().split())
    if x+y <= t and (x+y)%2 == t%2:
        z+=1
        
if z==n:
    print('Yes')
else:
    print('No')
def main():
    n, *t = map(int, open(0).read().split())
    l = [(0, 0, 0)] + list(zip(*[iter(t)] * 3))
    for x, y in zip(l, l[1:]):
        dt = y[0] - x[0]
        dd = abs(y[1] - x[1]) + abs(y[2] - x[2])
        f = dd <= dt
        g = dt % dd == 0 or dt % dd == 2
        h = f and g
        if not h:
            print('No')
            break
    else:
        print('Yes')


if __name__ == '__main__':
    main()
N = int(input())
cs = []
t1, x1, y1 = 0, 0, 0
ans = 'Yes'
for i in range(N):
  t2, x2, y2 = map(int, input().split())
  d = abs(x1-x2) + abs(y1-y2)
  if d == 0 or d > (t2 - t1) or d % 2 != (t2 - t1) % 2:
    ans = 'No'
    break
  t1, x1, y1 = t2, x2, y2
print(ans)
N = int(input())

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

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

ans = 'Yes'

for j in range(N):
    dt = t[j+1] - t[j]
    dist = abs(x[j+1] - x[j]) + abs(y[j+1] - y[j])

    if dt % 2 != dist % 2 or dt < dist:
        ans = 'No'
        break

print(ans)
N = int(input())
L = []
for i in range(N):
    t = list(map(int, input().split()))
    L.append(t)

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

for i in range(1, N+1):
    time = abs(L[i-1][0] - L[i][0])
    distance = abs(L[i-1][1] - L[i][1]) + abs(L[i-1][2] - L[i][2])
    if (time < distance) or (time%2 != distance%2):
        print('No')
        exit()

print('Yes')
N=int(input())
t_pre=0
x_pre=0
y_pre=0

for i in range(N):
    t,x,y = map(int,input().split())
    t_af=t-t_pre
    x_af=x-x_pre
    y_af=y-y_pre
    if (abs(x_af+y_af)<=t_af) & ((x_af+y_af+t_af)%2 == 0):
      t_pre=t
      x_pre=x
      y_pre=y
      continue
    else:
        print("No")
        exit()
print("Yes")
def main():
    N = int(input())
    txy = [list(map(int,input().split())) for _ in range(N)]
    txy = [[0,0,0]] + txy
    #print(txy)
    for i in range(N):
        temp = txy[i+1][0] - txy[i][0] - abs(txy[i+1][1] - txy[i][1]) - abs(txy[i+1][2] - txy[i][2])  
        if not (temp % 2 == 0 and temp >= 0):
            print("No")
            return
    print("Yes")
        
main()
n = int(input())
time = 0
point = [0,0]
for i in range(n):
    t,x,y = map(int,input().split())
    distance = abs(x-point[0]) + abs(y-point[1])
    dum_time = t-time
    if distance > dum_time:
        print("No")
        exit()
    elif distance%2 != dum_time%2:
        print("No")
        exit()
    time = t
    point[0] = x
    point[1] = y
print("Yes")
n=int(input())
X=0
Y=0
T=0
f=1
for _ in range(n):
    t,x,y=map(int,input().split())
    dx=abs(x-X)
    dy=abs(y-Y)
    dt=t-T
    if dt>=dx+dy and dt%2==(dx+dy)%2:
        pass
    else:
        f=0
print("Yes" if f else "No")
N = int(input())
yes = True
for _ in range(N):
  t, x, y = map(int, input().split())
  margin = t - (x + y)
  if margin < 0 or margin % 2 != 0:
    yes = False
if yes:
  print("Yes")
else:
  print("No")
# -*- coding: utf-8 -*-

t, x, y = 0, 0, 0

N = int(input())
for _ in range(N):
    t_next, x_next, y_next = map(int, input().split())

    diff_kyori = abs(x - x_next) + abs(y - y_next)
    diff_time = t_next - t

    if diff_kyori > diff_time:  # 距離が時間より大きい
        print('No')
        exit(0)
    if (diff_kyori - diff_time) % 2 == 1:  # 距離と時間の差
        print('No')
        exit(0)

    t, x, y = t_next, x_next, y_next

print('Yes')
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, t = xi, yi, ti
  if dist<=dt and dist%2==dt%2:
    continue
  else:
    flag=False
print("Yes") if flag else print("No")
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 == 1 or (A[i][0]-T) < abs(A[i][1]-place[0]) + abs(A[i][2]-place[1]):
    print("No")
    exit()
  else:
    T = A[i][0]
    place = (A[i][1], A[i][2])
print("Yes")
N=int(input())
pos=[0,0]
now=0
flag=True
for i in range(N):
  t,x,y=map(int,input().split())
  d = abs(x-pos[0])+abs(y-pos[1])
  if d>t-now:
    flag=False
    break
  else:
    if d%2==(t-now)%2:
      now=t
      pos[0],pos[1]=x,y
    else:
      flag=False
      break
if flag:
  print("Yes")
else:
  print("No")
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())

ans = "Yes"
for i in range(N):
  dd = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  dt = t[i+1] - t[i]
  if dt < dd:
    ans = "No"
  elif (dd - dt) % 2 != 0:
    ans = "No"
print(ans)
n = int(input())

now_t = 0
now_xy = 0
for i in range(n):
    t, x, y = map(int, input().split())
    baf = 0
    if not abs((x+y) - now_xy) == t - baf*2 - now_t:
        while t-baf*2-now_t >= 2:
            baf += 1
            if abs((x+y) - now_xy) == t - baf*2 - now_t:
                break
        else:
            print("No")
            exit()
    now_t = t
    now_xy = x + y
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())
t = [0] * (n + 1)
x = [0] * (n + 1)
y = [0] * (n + 1)
for i in range(n):
    t[i+1], x[i+1], y[i+1] = map(int, input().split())

can = True
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 = False
    # ここはよくわかっていない
    if dist % 2 != dt % 2:
        can = False
if can:
    print("Yes")
else:
    print("No")
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(a)
n = int(input())
T, X, Y = [0], [0], [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):
    d = abs(X[i + 1] - X[i]) + abs(Y[i + 1] - Y[i])
    e = T[i + 1] - T[i]
    if d > e or (d + e) % 2 == 1:
        print('No')
        break
else:
    print('Yes')
n=int(input())
t0=0
x0=0
y0=0
ok=True
for i in range(n):
  t1,x1,y1=map(int,input().split())
  c=t1-t0-x1+x0-y1+y0
  if c<0 or c%2==1:
    ok=False
    break
print('Yes' if ok else 'No')
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]

now_t=0
now_x=0
now_y=0

for nt,nx,ny in l:
  d_dist=abs(nx-now_x)+abs(ny-now_y)
  d_t=nt-now_t
  if d_dist>d_t or (d_t-d_dist)%2==1:
    print('No')
    exit()
  now_t=nt
  now_x=nx
  now_y=ny

print('Yes')
N = int(input())
_t, _x, _y = 0, 0, 0
flg = True
for i in range(N):
    t, x, y = list(map(int, input().split()))
    dt = t - _t
    dd = abs(x - _x) + abs(y - _y)
    if not (dd <= dt and dt % 2 == dd % 2):
        flg = False
    _t, _x, _y = t, x, y
if flg:
    print('Yes')
else:
    print('No')
n = int(input())
t_,x_,y_ = 0,0,0

def trip(t,x,y):
  l = abs(x)+abs(y)
  if t-l >= 0 and (t-l)%2 == 0:
    return 1
  else:
    return 0
  
e = 0
for _ in range(n):
  t,x,y = map(int,input().split())
  t_ = t - t_
  x_ = x - x_
  y_ = y - y_
  if trip(t_,x_,y_) == 1:
    continue
  else:
    e = 1
    print('No')
    break
if e == 0:
  print('Yes')
n = int(input())
prev_t = 0
prev_x = 0
prev_y = 0
for i in range(n):
    t, x, y=map(int, input().split())
    if abs(prev_x - x) + abs(prev_y - y) > (t - prev_t) or (abs(prev_x - x) + abs(prev_y - y) + (t - prev_t)) % 2:
        print("No")
        exit()
    prev_t = t
    prev_x = x
    prev_y = y
print("Yes")
num_list=int(input())
a=[0,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 dt%2==d%2:
    if i == num_list-1:
      print("Yes")
      break
    a=b
  else:
    print("No")
    break
n=int(input())
old=[0,0,0]
for i in range(n):
  t,x,y=map(int,input().split())
  tt=t-old[0]
  xx=x-old[1]
  yy=y-old[2]
  dist=abs(xx)+abs(yy)
  if tt%2 != (xx+yy)%2 or dist>tt:
    print("No")
    exit()
  old=[t,x,y]
  
print("Yes")
n=int(input())
bx=by=bt=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)>abs(bt-t):
        ans='No'
    bx=x
    by=y
    bt=t

print(ans)
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")
n = int(input())
ans = 'Yes'
t_before,x_before,y_before = 0,0,0
for _ in range(n):
    t,x,y = map(int, input().split())
    delta_x = abs(x-x_before)
    delta_y = abs(y-y_before)
    delta_t = t-t_before
    if ((delta_x+delta_y)%2 != delta_t%2) or (delta_x+delta_y>delta_t):
        ans = 'No'
        break
    t_before = t
    x_before = x
    y_before = y
print(ans)
N = int(input())
x, y = 0, 0
b = False
for _ in range(N):
    T, X, Y = map(int, input().split())
    if abs(X-x)+abs(Y-y) > T or abs(X-x)+abs(Y-y)+T&1:
        b = True
print("YNeos"[b::2])
N=int(input())
txy = [list(map(int,input().split())) for _ in range(N)]

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

flag = 0

for n in range(1,N+1):
  if txy[n][0] % 2 != (txy[n][1] + txy[n][2])%2 or \
  abs(txy[n][0] - txy[n-1][0]) < abs(txy[n][1] - txy[n-1][1]) + abs(txy[n][2] - txy[n-1][2]):
    flag = 1
    break

if flag == 0:
  print("Yes")
else:
  print("No")
n=int(input())
a=[[0,0,0]]

for i in range(n):
  a.append(list(map(int, input().split(" "))))
for i in range(n):
  check =  a[i + 1][0] - a[i][0] - (abs(a[i+1][1]-a[i][1]) + abs(a[i+1][2]-a[i][2]))
  if check >= 0 and check % 2 == 0:
    continue
  else:
    print("No")
    break
else:
  print("Yes")
N = int(input())

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

current = [0, 0, 0]
can = True
for m in M:
  dt = m[0] - current[0]
  dist = abs(m[1] - current[1]) + abs(m[2] - current[2])
  if (dist > dt):
    can = False
    break
  else:
    if (dist % 2 != dt % 2):
      can = False
      break
  current = m

result = "Yes" if (can == True) else "No"
print(result)
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 = True
for i in range(N):
    time = T[i+1]-T[i]
    dist = abs(X[i+1]-X[i])+abs(Y[i+1]-Y[i])
    if time < dist or (dist%2!=time%2):
        flag = False
        break
if flag:
    print('Yes')
else:
    print('No')
N = int(input())

nx = 0
ny = 0
nt = 0
for _ in range(N):
    t, x, y = map(int, input().split())
    k = abs(nx-x)+abs(ny-y)
    if k > t-nt:
        print("No")
        break
    if (k-(t-nt))%2 != 0:
        print("No")
        break
    nx = x
    ny = y
    nt = t
else:
    print("Yes")
#!/bin/env python3

N = int(input())

t_prev = x_prev = y_prev = 0
for i in range(N):
    t_i, x_i, y_i = map(int, input().split())

    if (x_i+y_i)> t_i:
        print("No")
        exit()
    elif (x_i+y_i) %2 != t_i%2 :
        print("No")
        exit()
    elif (abs(x_i - x_prev) + abs(y_i - y_prev)) > (t_i - t_prev):
        print("No")
        exit()
    t_prev, x_prev, y_prev = t_i, x_i, y_i

print("Yes")
N = int(input())
travel = [0, 0, 0]
flag = True
for i in range(N):
    new_travel =  list(map(int, input().split(' ')))
    change = [new_travel[i] - travel[i] for i in range(3)]
    if abs(change[1]) + abs(change[2]) - change[0] > 0 or\
    ((abs(change[1]) + abs(change[2])) - change[0])%2 !=0:
        print('No')
        flag = False
        break
    travel = new_travel

if flag == True:
    print("Yes")
n=int(input())
x=0
y=0
t=0
fl=True
for i in range(n):
  nt,nx,ny=map(int,input().split())
  dist=abs(x-nx)+abs(y-ny)
  if (nt-t)%2!=dist%2 or (nt-t)<dist:
    print("No")
    break
  x,y=nx,ny
  t=nt
else:
  print("Yes")
n = int(input())
txy = [list(map(int,input().split())) for _ in range(n)]
t = txy[0][0]
go = txy[0][1] + txy[0][2]
if t < go or t%2 != go%2:
    print("No")
    exit()
for i in range(n-1):
    t = txy[i+1][0] - txy[i][0]
    go = abs(txy[i+1][1] - txy[i][1]) + abs(txy[i+1][2] - txy[i][2])
    if t < go or t%2 != go%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.append(t_)
    x.append(x_)
    y.append(y_)

can = True
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 = False
    if dist % 2 != dt % 2:
        can = False

if can:
    print("Yes")
else:
    print("No")
n  = int(input())
plan = [tuple(map(int, input().split())) for _ in range(n)]

now, now_x, now_y = 0, 0, 0

for t, x, y in plan:
    if abs(x - now_x) + abs(y - now_y) > t - now:
        print('No')
        exit()
    elif ((t - now) - abs(x - now_x) - abs(y - now_y)) % 2 == 1:
        print('No')
        exit()
    now = t
    now_x = x
    now_y = y
print('Yes')
n=int(input());t,x,y=[],[],[]
for _ in range(n):
  a,b,c=map(int,input().split())
  t.append(a);x.append(b),y.append(c)
for i in range(n):
  r1,r2=[[t[0],x[0]+y[0]],[t[i]-t[i-1],abs(x[i]-x[i-1])+abs(y[i]-y[i-1])]][i!=0]
  if not (r1>=r2 and r1%2==r2%2): print('No');break
else:
  print('Yes')
n=int(input())
t0,x0,y0=0,0,0
ans="Yes"
for i in range(n):
    t,x,y=map(int,input().split())
    d=abs(x-x0)+abs(y-y0)
    if t-t0<d or (t-t0-d)%2==1:
        ans="No"
        break
    else:
        t0,x0,y0=t,x,y
print(ans)
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    t = [[0,0,0]]
    for _ in range(n):
        t.append(list(map(int,input().split())))
    for i in range(n):
        time = t[i+1][0] - t[i][0]
        distance = abs(t[i+1][1] - t[i][1]) + abs(t[i+1][2] - t[i][2])
        if time < distance or (time-distance) % 2 == 1:
            print('No')
            return
    print('Yes')

if __name__ == '__main__':
    main()
def dist(x,y):
    return abs(x[0]-y[0])+abs(x[1]-y[1])
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
flag = 0
t1 = 0
x1,y1 = 0,0
for i in range(N):
    t2,x2,y2 = X[i]
    dt = t2-t1
    d = dist((x1,y1),(x2,y2))
    if dt>=d and (dt-d)%2==0:
        t1,x1,y1 = t2,x2,y2
        continue
    flag = 1
    break
if flag==0:
    print("Yes")
else:
    print("No")
# coding: utf-8


def main():
    N = int(input())
    ans = 'Yes'
    t, x, y = 0, 0, 0
    for _ in range(N):
        nt, nx, ny = map(int, input().split())
        d = abs(x - nx) + abs(y - ny)
        if d > nt - t or (nt - t - d) % 2 != 0:
            ans = 'No'
            break
        t, x, y = nt, nx, ny

    print(ans)

if __name__ == "__main__":
    main()
#coding:utf-8
t = 0
n = int(input())
x, y = 0, 0
for _ in range(n):
    t_i, x_i, y_i = map(int, input().split(' '))
    t_d = t_i - t
    x_d = abs(x_i - x)
    y_d = abs(y_i - y)
    
    t, x, y = t_i, x_i, y_i
    if x_d + y_d <= t_d and (x_d + y_d) % 2 == t_d % 2:
        continue
    else:
        print('No')
        break
else:
    print('Yes')
n = int(input())
t, x, y = 0, 0, 0
for _ in range(n):
    nt, nx, ny = map(int, input().split())
    d = abs(nx-x)+abs(ny-y)
    
    if nt-t<d or d%2!=(nt-t)%2:
        print('No')
        exit()
    
    t, x, y = nt, nx, ny

print('Yes')
N=int(input())
nt=0
nx=0
ny=0
for i in range(N):
    t,x,y=map(int,input().split())
    d=t-nt
    dxy=abs(x-nx)+abs(y-ny)
    if(d<dxy or d%2!=dxy%2):
        print("No")
        exit()
    else:
        nt=t
        nx=x
        ny=y
print("Yes")
import sys
N = int(input())
T = [list(map(int, input().split())) for i in range(N)]

x, y = 0, 0
t = 0
for i in range(N):
    t1 = T[i][0] - t
    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()
    t = T[i][0]
    x = x1
    y = y1
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
if count==N:
    print('Yes')
else:
    print('No')
n=int(input());t,x,y,r1,r2=[],[],[],0,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(n):
  r1,r2=[[t[0],x[0]+y[0]],[t[i]-t[i-1],abs(x[i]-x[i-1])+abs(y[i]-y[i-1])]][i!=0]
  if not (r1>=r2 and r1%2==r2%2): print('No');break
else:
  print('Yes')
N = int(input())
ans = True
t1,x1,y1 = 0,0,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)-(abs(x2-x1)+abs(y2-y1)))%2 == 0:
        None
    else:
        ans = False
        break
    t1,x1,y1 = t2,x2,y2
    #print(i)
print("Yes" if ans==True else "No")
n=int(input())
tx=ty=tt=0
for i in range(n):
  t,x,y=map(int,input().split())
  m=abs(x-tx)+abs(y-ty)
  if t<x+y or(t-tt)%2!=m%2:
    print("No")
    exit()
print("Yes")
N = int(input())
t, x, y = 0, 0, 0
for i in range(N):
    t_i, x_i, y_i = map(int, input().split())
    T = t_i-t
    D = abs(x_i-x) + abs(y_i-y)
    if T % 2 != D % 2 or D > T:
        print("No")
        exit()
    else:
        t = t_i
        x = x_i
        y = y_i
print("Yes")
N = int(input())
t, x, y = 0, 0, 0
for i in range(N):
    t_1, x_1, y_1 = map(int, input().split())
    distance = abs(x - x_1) + abs(y - y_1)
    if distance > t_1 - t or (t_1 - t - distance) % 2 != 0:
        print("No")
        exit()
print("Yes")
n = int(input())

t = [0]*1001001
x = [0]*1001001
y = [0]*1001001


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

flag = 1    
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:
        flag = 0
    if dist % 2 != dt % 2:
        flag = 0

if flag:
    print("Yes")
else:
    print("No")
n = int(input())
now = [0, 0, 0]
ans=True
for i in range(n):
    t, x, y = map(int, input().split())
    if t-now[0] < abs(x-now[1])+abs(y-now[2]):
        ans=False
        
    else:
        if ((t-now[0])-(abs(x-now[1])+abs(y-now[2]))) % 2 == 0:
            now = [t, x, y]
        else:
            ans=False
        
if ans:
    print("Yes")
else:
    print("No")
N = int(input())
trip = [list(map(int, input().split(' '))) for i in range(N)]

point = [0, 0, 0]

for i in range(N):
    time = trip[i][0]-point[0]
    x = abs(trip[i][1]-point[1])
    y = abs(trip[i][2]-point[2])
    if ((time-x-y) % 2) or (time < (x+y)):
        print('No')
        exit()
    point = trip[i]

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