AtCoDeer the deer is going on a trip in a two-dimensional plane.
In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.
If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).
Note that he cannot stay at his place.
Determine whether he can carry out his plan.

-----Constraints-----
 - 1 ≤ N ≤ 10^5
 - 0 ≤ x_i ≤ 10^5
 - 0 ≤ y_i ≤ 10^5
 - 1 ≤ t_i ≤ 10^5
 - t_i < t_{i+1} (1 ≤ i ≤ N-1)
 - All input values are integers.

-----Input-----
Input is given from Standard Input in the following format:
N
t_1 x_1 y_1
t_2 x_2 y_2
:
t_N x_N y_N

-----Output-----
If AtCoDeer can carry out his plan, print Yes; if he cannot, print No.

-----Sample Input-----
2
3 1 2
6 1 1

-----Sample Output-----
Yes

For example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).

Difficulty: introductory

Starter code:

Solutions:
N = int(input())

T = 0
X = 0
Y = 0

for i in range(N):
    t, x, y = list(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; X=0; Y=0;
ans="Yes"
for i in range(n):
    t,x,y=map(int,input().split())
    s=t-T
    if s >= abs(X-x)+abs(Y-y) and (s-abs(X-x)+abs(Y-y))%2==0:
        T,X,Y = t,x,y
    else:
        ans="No"
        break
print(ans)

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")
    return
  if (time-dis)%2 == 1:
    print("No")
    return
    
  
  time = t
  locx = x
  locy = y
    
  
else :
  print("Yes")

from collections import deque
N = int(input())
txy = [map(int, input().split()) for _ in range(N)]
t, x, y = [list(i) for i in zip(*txy)]
t = deque(t)
x = deque(x)
y = deque(y)
t.appendleft(0)
x.appendleft(0)
y.appendleft(0)
for i in range(N):
    direct = t[i+1] - t[i] - abs(x[i+1] - x[i]) - abs(y[i+1] - y[i])
    if direct < 0 or direct % 2 != 0:
        print("No")
        return
print("Yes")

n = int(input())
xx = 0
yy = 0
tt = 0
for i in range(n):
    t, x, y = map(int, input().split())
    d = abs(xx - x) + abs(yy - y)
    if t - tt < d or (t - tt - d) % 2 == 1:
        print('No')
        return
    xx = x
    yy = y
    tt = t
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)

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

#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)

n = int(input())

t, x, y = 0, 0, 0
for i in range(n):
    t_new, x_new, y_new = list(map(int, input().split()))

    time = t_new-t
    dis = abs(x_new-x)+abs(y_new-y)

    if time < dis:
        print("No")
        return
    if time % 2 != dis % 2:
        print("No")
        return
    t, x, y = t_new, x_new, y_new
print("Yes")


N = int(input())
t = 0
xy = [0,0]
ans = 'Yes'
for i in range(N):
    ti,xi,yi = map(int,input().split())
    dt = ti - t
    dx = abs(xi - xy[0])
    dy = abs(yi - xy[1])
    if dt < dx+dy:
        ans = 'No'
    elif dt%2 != (dx+dy)%2:
        ans = 'No'
    t = ti
    xy = [xi,yi]
print(ans)

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

for t in range(n):
    dt=n_list[t+1][0]-n_list[t][0]
    dist=abs(n_list[t+1][1]-n_list[t][1])+abs(n_list[t+1][2]-n_list[t][2])

    if(dist>dt):
        can='No'
        break
    xy=n_list
    if(dist%2 != dt%2):
        can='No'
        break
    can='Yes'
print(can)

# https://atcoder.jp/contests/abc086/tasks/arc089_a
n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]

px, py = (0, 0)
pt = 0

for t, x, y in txy:
  if not (x + y <= t and (x + y) % 2 == t % 2 and abs(x - px) + abs(y - py) <= t - pt):
    print('No')
    return
  px, py = x, y
  pt = t

print('Yes')


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

check = True
for i in range(1,N+1):
  K = txy[i][0] - txy[i-1][0]
  tmp = K - abs(sum(txy[i][1:]) - sum(txy[i-1][1:]))
  if tmp < 0 or tmp % 2 == 1:
    check = False
    break
    
print("Yes" if check else "No")

N=int(input())
t=[]
x=[]
y=[]
for i in range(N):
    txy=list(map(int,input().split()))
    t.append(txy[0])
    x.append(txy[1])
    y.append(txy[2])

now_x=0
now_y=0
now_time=0
isOK=True
for i in range(N):
    dist=(x[i]-now_x)**2+(y[i]-now_y)**2
    time=t[i]-now_time

    if dist<=time**2 and dist%2 ==time%2:
        now_x=x[i]
        now_y=y[i]
        now_time=t[i]
    else:
        isOK=False
        break
        

if isOK:
    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())
  t=abs(t_-t)
  x=abs(x_-x)
  y=abs(y_-y)
  if x+y>t:
    print('No')
    return
  if t_%2!=(x_+y_)%2:
    print('No')
    return
  
print('Yes')

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

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

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

n = int(input())

prev_t, prev_x, prev_y = 0, 0, 0
for _ in range(n):
    t, x, y = map(int, input().split())
    if (abs(x - prev_x) + abs(y - prev_y) <= t - prev_t and
        (abs(x - prev_x) + abs(y - prev_y)) % 2 == (t - prev_t) % 2):
        prev_t, prev_x, prev_y = t, x, y
        continue
    else:
        print('No')
        break
else:
    print('Yes')

N = int(input())
l = []
now = [0,0,0]
ans = 'Yes'
for _ in range(N):
    inp = list(map(int,input().split()))
    l.append(inp)

for i in range(N):
    shortest = abs(l[i][1] - now[1]) + abs(l[i][2] - now[2])
    if shortest > l[i][0]-now[0]:
        ans = 'No'
        break
    a = l[i][0] -now[0]- shortest
    if a % 2 !=0:
        ans = 'No'
        break
    else:
        now = l[i]
print(ans)

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

for i in range(n):
  mt,mx,my= map(int,input().split())
  ft = mt - t
  fx = abs(x-mx)
  fy = abs(y-my)
  if fx + fy > ft:
    print("No")
    return
  elif (ft - (fx + fy)) % 2 == 0:
    pass
  else:
    print("No")
    return
  x,y,t=mx,my,mt
print("Yes")

N = int(input())
t, x, y = 0, 0, 0
ans = "Yes"

for i in range(N):
  nt, nx, ny = map(int,input().split())
  if ((nt - t) - abs(nx - x) - abs(ny - y))%2 != 0 or abs(nx - x) + abs(ny - y) > (nt - t):
    ans = "No"
    break
  else:
    t = nt
    x = nx
    y = ny

print(ans)


N = int(input())

res = True
pre_t, pre_x, pre_y = 0, 0, 0
for _ in range(N):
    t, x, y = list(map(int, input().split()))
    tmp = (t - pre_t) - abs(x - pre_x) - abs(y - pre_y)
    if tmp < 0 or tmp % 2 == 1:
        res = False
        break
    pre_t = t
    pre_x = x
    pre_y = y
    
print(('Yes' if res else 'No'))


n = int(input())
x, y = 0, 0
t = 0
for i in range(n):
    ti, xi, yi = list(map(int, input().split()))
    l = abs(xi - x + yi - y)
    if l <= ti - t and l % 2 == (ti - t) % 2:
        x, y = xi, yi
        t = ti
    else:
        print("No")
        break
else:
    print("Yes")


from collections import namedtuple
plan = namedtuple('plan', ['time', 'x', 'y'])

def main():
    with open(0) as f:
        N = int(f.readline())
        plans = []
        for _ in range(N):
            t, x, y = map(int, f.readline().split())
            plans.append(plan(t, x, y))
    current = plan(0, 0, 0)
    for p in plans:
        t = p.time - current.time
        way = abs(p.x-current.x) + abs(p.y-current.y)
        if t < way:
            print('No')
            return None
        if (t - way) & 1:
            print('No')
            return None
        current = p
    else:
        print('Yes')

main()

#2パターンでのfail
#①→偶奇がstepと位置で違う
#単純に遠すぎる
n = int(input())

t_pre =0
x_pre =0
y_pre =0
for i in range(n):
    t,x,y = list(map(int,input().split()))
    if (t-t_pre)<abs(x-x_pre)+abs(y-y_pre):
        print('No')
        break
    if t%2 != (x+y)%2:
        print('No')
        break
    t_pre = t
    x_pre =x
    y_pre = y
    
    if i ==n-1:
        print('Yes')

N = int(input())
txy = [[0, 0, 0]]
for i in range(N):
  txy.append(list(map(int, input().split())))

for i in range(N):
  dt = txy[i+1][0] - txy[i][0]
  dx = txy[i+1][1] - txy[i][1]
  dy = txy[i+1][2] - txy[i][2]
  
  if dt < abs(dx + dy):
    print('No')
    break
  else:
    if (dt - (dx + dy)) % 2 != 0:
      print('No')
      break
else:
  print('Yes')

import sys

input = sys.stdin.readline

def main():
    ans = 'Yes'
    n = int(input())
    now = [0,0]
    pt = 0
    for i in range(n):
        t, x, y = map(int, input().split())
        d = abs((x - now[0]) + (y - now[1]))
        if d > abs(t - pt) or (t - pt)%2 != d%2:
            ans = "No"
            break
        now = [x, y]
        pt = t
    print(ans)

def __starting_point():
    main()
__starting_point()

n=int(input())
s = 0
a = 0
b = 0
for i in range(n):
    t,x,y=map(int,input().split())
    if t-s - abs(x-a) - abs(y-b)>=0 and (t-s - abs(x-a) - abs(y-b)) %2 == 0:
        s = t
        a = x
        b = y
    else:
        print('No')
        return
print('Yes')

n = int(input())
x0 = 0
y0 = 0
t0 = 0
for i in range(n):
  
  t, x, y = map(int, input().split())
  d = abs(x - x0) + abs (y - y0)
  if d > t - t0:
    print('No')
    return
  elif (t - t0 - d) % 2 == 1:
    print('No')
    return
  else:
    x0 = x
    y0 = y
    t0 = t

print('Yes')

n = int(input())
rx = 0
ry = 0
rt = 0
ok = True
for _ in range(n):
    t, x, y = map(int, input().split())
    dist = abs(x-rx) + abs(y-ry)
    #print(dist)
    if dist <= abs(t-rt) and (abs(t-rt)-dist)%2 == 0:
        rx = x
        ry = y
        rt = t
    else:
        print("No")
        return
print("Yes")

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

flag = True
for i in range(N):
  if not flag:
    break
  time = int(A[i+1][0]) - int(A[i][0])
  dist = abs(A[i+1][1] - A[i][1]) + abs(A[i+1][2] - A[i][2]) # x2-x1 + y2-y1
  if time < dist:
    flag = False
  elif time % 2 != dist % 2:
    flag = False

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

import numpy as np
N = int(input())

txy = [[0,0,0]]
for i in range(N):
    txy.append(list(map(int,input().split())))

out='Yes'
for i in range(1,N+1):
    x = np.array(txy[i])
    y = np.array(txy[i-1])
    mv = abs(x-y)
    # print(mv)
    dam = mv[0] - (mv[1] + mv[2])
    if dam%2==1 or dam<0:
        out='No'

print(out)


N = int(input())
P = [[0,0,0]]
for i in range(N):
    t,x,y = list(map(int,input().split()))
    P.append([t,x,y])
judge = True
for i in range(1,N+1):
    dt = P[i][0] - P[i-1][0]
    dist = abs(P[i][1] - P[i-1][1]) + abs(P[i][2] - P[i-1][2])
    if (dt % 2 == 0 and dist % 2 == 0 and dist <= dt) or (dt % 2 == 1 and dist % 2 == 1 and dist <= dt):
        judge = True
    else:
        judge = False
if judge:
    print("Yes")
else:
    print("No")


from sys import stdin, stdout # only need for big input


def solve():
    n = int(input()) 
    pos = []
    for _ in range(n):
        t, x, y = list(map(int, input().split()))
        pos.append((t,x,y))

    prev = (0, 0, 0)

    for p in pos:
        dt = p[0] - prev[0]
        move = abs(p[1] - prev[1]) + abs(p[2] - prev[2])
        if move > dt:
            print("No")
            return
        else:
            if (dt - move) % 2 == 1:
                print("No")
                return
            prev = p

    print("Yes")

    
    

def main():
    solve()


def __starting_point():
    main()
__starting_point()

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

#print(T)
#print(S)

for i in range(1,N+1):
  if (T[i]-T[i-1])<(abs(S[i][0]-S[i-1][0])+abs(S[i][1]-S[i-1][1])):
    f=1
  if (T[i]-T[i-1])%2!=(abs(S[i][0]-S[i-1][0])+abs(S[i][1]-S[i-1][1]))%2:
    f=1

print("Yes" if f==0 else "No")

N = int(input())
t, x, y = 0, 0, 0
ans = 'Yes'

for n in range(N):
    ti,xi,yi = map(int,input().split())
    dist = abs(xi-x)+abs(yi-y)
    dt = ti-t
    if dist > dt or (dist-dt) % 2 != 0:
        ans='No'
        break
    t,x,y = ti,xi,yi
print(ans)

t, x, y = 0, 0, 0

for i in range(int(input())):
    t_n, x_n, y_n = map(int, input().split())
    diff = abs(x - x_n) + abs(y - y_n)
    if diff > t_n - t or (t_n - t - diff) % 2 == 1:
        print("No")
        return
    t, x, y = t_n, x_n, y_n
print("Yes")

# coding: utf-8


def main():
    N = int(input())
    ans = 'Yes'
    t, x, y = 0, 0, 0
    for _ in range(N):
        nt, nx, ny = list(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)

def __starting_point():
    main()

__starting_point()

#!/user/bin/env pypy3
import sys
from typing import NamedTuple, List


def fast_input():
    return sys.stdin.readline()[:-1]


class Position(NamedTuple):
    t: int
    x: int
    y: int

    def _calc_diff_move(self, position) -> int:
        diff_x = self.x - position.x
        diff_y = self.y - position.y
        return abs(diff_x) + abs(diff_y)

    def can_move_from(self, prev) -> bool:
        diff_t = self.t - prev.t
        diff_move = self._calc_diff_move(prev)
        if not diff_t % 2 == diff_move % 2:
            return False
        return diff_t >= diff_move


def result_format(b: bool) -> str:
    return "Yes" if b else "No"


def solve(positions: List[Position]) -> bool:
    positions = [Position(t=0, x=0, y=0)] + positions
    for p_ind in range(len(positions) - 1):
        p_curr = positions[p_ind]
        p_next = positions[p_ind + 1]
        if not p_next.can_move_from(p_curr):
            return False
    return True


def main():
    n = int(fast_input())
    positions = []
    for _ in range(n):
        t, x, y = list(map(int, fast_input().split()))
        positions.append(Position(t=t, x=x, y=y))
    result = solve(positions)
    print((result_format(result)))


main()


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')
        return
    t_param = t
    x_param = x
    y_param = y
print('Yes')

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

pT, pX, pY = 0, 0, 0

for i in range(n):
    cT, cX, cY = d[i]
    mvT, mvX, mvY = abs(cT-pT), abs(cX-pX), abs(cY-pY)
    
    dam = mvT - (mvX+mvY)

    if dam%2 == 1 or dam<0:
        print('No')
        return

    pT, pX, pY = d[i]

print('Yes')

n = int(input())

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

for i in range(n):
    move = abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2])
    time = txy[i+1][0]-txy[i][0]
    if time % 2 ^ move % 2 == 1 or time < move:
        print("No")
        return

print("Yes")

n_num = int(input())
plan_list = [[0, (0, 0)]]

def movable(p1, p2):
    time = p2[0] - p1[0]
    distance = 0
    
    distance += abs(p1[1][0] - p2[1][0])
    distance += abs(p1[1][1] - p2[1][1])
    
    if distance > time:
        return 0
    else:
        if (time - distance) % 2 != 0:
            return 0
        else:
            return 1
    

for _ in range(n_num):
    line = [int(i) for i in input().split()]
    plan_list.append([line[0], (line[1], line[2])])
    
vector = (0, 0)

flag = 0
for n in range(1, n_num+1):
    if movable(plan_list[n-1], plan_list[n]) == 0:
        flag = 1
    
if flag == 1:
    print('No')
else:
    print('Yes')

# 最短でたどり着いたとして目的の時間までの残り時間が奇数ならばNo
# あとそもそも時間を使ってもたどりつけない場合もNo
n = int(input())
pos = [0, 0]
time = 0
for _ in range(n):
    t, x, y = list(map(int, input().split()))
    # 最短でたどりつく時間
    dist = abs(pos[0] - x) + abs(pos[1] - y)
    # そもそもたどりつけない場合
    if t - time < dist:
        print("No")
        return
    # 偶奇性
    rest = t - time
    if rest % 2 != dist % 2:
        print("No")
        return
    time = t
    pos = [x, y]
print("Yes")


N = int(input())

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

position = {"x":0, "y":0}
preT = 0
for i in range(N):
    T = Input[i][0]
    x = Input[i][1]
    y = Input[i][2]

    move = abs(position["x"] - x) + abs(position["y"] - y)
    if move > (T - preT) or move % 2 != (T - preT) % 2:
        print("No")
        return

    preT = T
    position["x"] = x
    position["y"] = y

print("Yes")

import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return list(map(int, input().split()))
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

def main():
    n = i_input()
    xb = 0
    yb = 0
    tb = 0
    for i in range(n):
        t,x,y = i_map()
        walk = abs(x-xb) + abs(y-yb)
        if walk > t-tb: # 時間足りない
            print("No")
            return
        if ((t-tb)-walk)%2 != 0: # 戻って来れん
            print("No")
            return
        xb = x
        yb = y
        tb = t
    print("Yes")






def __starting_point():
    main()

__starting_point()

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:
        print("No")
        return
    if abs(dt - t) % 2:
        if dist % 2 == 0:
            print("No")
            return
    else:
        if dist % 2 == 1:
            print("No")
            return
    x, y, t = dx, dy, dt
print("Yes")

N = int(input())
t0, x0, y0 = 0, 0, 0
for i in range(N):
    t, x, y = list(map(int, input().split()))
    kyori = abs(x - x0) + abs(y - y0)
    time = t - t0
    if (abs(kyori - time)) % 2 == 0 and time - kyori >= 0:
        t0, x0, y0 = t, x, y
    else:
        print('No')
        return
print('Yes')


N = int(input())
P = [(0,0,0)] + [tuple(int(x) for x in input().split()) for _ in range(N)]

def travelable(p,q):
    time = q[0] - p[0]
    dist = abs(q[1]-p[1]) + abs(q[2]-p[2])
    if dist <= time and time%2 == dist%2:
        return True
    else:
        return False
from itertools import zip_longest
print('Yes' if all(travelable(p,q) for p,q in zip_longest(P[:N],P[1:])) else 'No')

N = int(input())
t_x_y = [list(map(int, input().split())) for _ in range(N)]
t_x_y.insert(0, [0, 0, 0])
 
ans = 'Yes'
for i in range(N):
  dt = t_x_y[i+1][0] - t_x_y[i][0]
  dist = abs(t_x_y[i+1][1] - t_x_y[i][1]) + abs(t_x_y[i+1][2] - t_x_y[i][2])
  
  # dt < dist が必要
  if dt < dist:
    ans = 'No'
    break
  else:
    # dt >= dist の上で、dtとdistの偶奇が一致すればよい
    if (dt - dist) % 2 != 0:
      ans = 'No'
      break
  
print(ans)

N = int(input())
t,x,y = 0,0,0
for i in range(N):
    a,b,c = t,x,y
    t,x,y = map(int,input().split())
    d = abs(x-b)+abs(y-c)
    e = t-a
    if d%2 != e%2 or d > e:
        print("No")
        return
print("Yes")

import math
n = int(input())
#P position t time
P = [0,0]
t0 = 0
for _ in range(n):
  t,x,y = list(map(int, input().split( )))
  dt = t - t0
  dis = abs(x - P[0])  + abs(y - P[1])
  if dis > dt:
    print('No')
    return
  elif (dt - dis)%2 == 1:
    print('No')
    return
  t0 = t
  P = [x,y]
print('Yes')
    


N = int(input())
T = [0, 0, 0]
ans = "Yes"
for _ in range(N):
    t = list(map(int, input().split()))
    k = abs((t[1]+t[2])-(T[1]+T[2]))
    n = t[0]-T[0]
    if n % 2 == 0:
        if k > n or k % 2 != 0:
            ans = "No"
    else:
        if k > n or k % 2 == 0:
            ans = "No"
    T = t

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')
        return

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 - t - dist) % 2:
        print("No")
        return

    x, y, t = dx, dy, dt
print("Yes")

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

import sys
N = int(input())
d = [list(map(int,input().split())) for l in range(N)]
d.insert(0,[0,0,0])
#print(N)
#print(d)

def get_length(l1,l2):
    return abs(l1[1] - l2[1]) + abs(l1[2] - l2[2])

for cnt in range(N):
    length = get_length(d[cnt],d[cnt+1])
    time = abs(d[cnt][0]-d[cnt+1][0])
    if length <= time and abs(time - length) % 2 == 0:
        pass
    else:
        print("No")
        return

print("Yes")

n=int(input())
a=[list(map(int,input().split())) for i in range(n)]
a.insert(0,[0,0,0])
for i in range(n):
    b=a[i+1][0]-a[i][0]
    c=abs(a[i+1][1]+a[i+1][2]-a[i][1]-a[i][2])
    if b<c or b%2!=c%2:
        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())
pt, px, py = 0,0,0
f = 0
for i in range(n):
    t,x,y = map(int, input().split())
    gt = t-pt
    gx, gy = abs(x-px), abs(y-py)
    gt -= gx+gy
    if gt < 0 or gt%2==1:
        f=1
    pt,px,py = t,x,y
if f:
    print("No")
else:
    print("Yes")

N = int(input())

px = 0
py = 0
pt = 0

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

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

print('Yes')


n = int(input())
pt, px, py = 0, 0, 0

for _ in range(n):
  t, x, y = map(int, input().split())
  d = abs(x-px) + abs(y-py)
  if d  > t-pt or (d + t-pt)%2 != 0:
    print("No")
    return
  pt, px, py = t, x, y
print("Yes")

N = int(input())

locx = 0
locy =0
time = 0
for i in range(N):
  t,x,y = map(int,input().split())
  nowtime = t-time
  dis = abs(locx-x)+abs(locy-y)
  if (nowtime-dis)<0 :
    print("No")
    return
  if (nowtime-dis)%2 == 1:
    print("No")
    return
    
  
  time = t
  locx = x
  locy = y
    
  
else :
  print("Yes")

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())
P = [list(map(int,input().split())) for i in range(N)] # list of [t, x, y]
pret = prex = prey = 0
f = 1
for i in range(N):
    t = P[i][0]
    x = P[i][1]
    y = P[i][2]
    td = t - pret
    xd = abs(x - prex)
    yd = abs(y - prey)
    diff = xd + yd # 最低かかるt
    if td < diff:
        f = 0
        break
    if (td - diff) % 2 == 0:
        pret = t
        prex = x
        prey = y
        continue
    else:
        f = 0
        break
if f == 1:
    print("Yes")
else:
    print("No")

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

ima = [0,0,0]
for i in range(N):
  dist = abs(ima[1] - txn[i][1]) + abs(ima[2] - txn[i][2])

  if dist > (txn[i][0] - ima[0]) :
    print("No")
    return
  
  if dist%2 != (txn[i][0] - ima[0])%2 :
    print("No")
    return
  
  ima = txn[i]

print("Yes")

N = int(input())
P = [(0,0,0)] + [tuple(int(x) for x in input().split()) for _ in range(N)]

def travelable(p,q):
    time = q[0] - p[0]
    dist = abs(q[1]-p[1]) + abs(q[2]-p[2])
    if dist <= time and time%2 == dist%2:
        return True
    else:
        return False
        
print('Yes' if all(travelable(p,q) for p,q in zip(P[:N],P[1:])) else 'No')

N = int(input())
success = True

t0,x0,y0 = 0,0,0
for i in range(N):
  t1,x1,y1 = map(int,input().split())
  dist = abs(x1-x0) + abs(y1-y0)
  time = t1 - t0
  
  check1 = (time == dist)
  check2 = (time > dist) and ((time - dist) % 2 == 0)
  if not (check1 or check2):
    success = False
    break
    
  t0,x0,y0 = t1,x1,y1
    
if success:
  print("Yes")
else:
  print("No")

n=int(input())

def func(start,goal,t):
    distance=abs(start[0]-goal[0])+abs(start[1]-goal[1])
    if distance<=t and (t-distance)%2==0:
        return True
    return False
now=0
can=1
start=[0,0]
for i in range(n):
    t,x,y=[int(i) for i in input().split()]
    goal=[x,y]
    if not func(start,goal,t-now):
        can=0
        break
    else:
        start=goal
        now=t

if can==1:
    print("Yes")
else:
    print("No")


n = int(input())
ti, xi, yi = (0,0,0)
for i in range(n):
  ti1, xi1, yi1 = list(map(int, input().split()))
  if abs(xi1-xi)+abs(yi1-yi) <= (ti1-ti) and (abs(xi1-xi)+abs(yi1-yi))%2 == (ti1-ti)%2:
    xi = xi1
    yi = yi1
    ti = ti1
    continue
  else:
    print("No")
    return
print("Yes")


n=int(input())
a = [0]*(n+1)
a[0] = [0, 0, 0]
for i in range(n):
    a[i+1]=list(map(int,input().split()))

flag = True
for i in range(n):
    if abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2]) > (a[i+1][0]-a[i][0]):
        flag=False
    elif (abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2])-(a[i+1][0]-a[i][0]))%2==1:
        flag=False

if flag:
    print("Yes")
else:
    print("No")


n=int(input())

num,a,b=0,0,0

for i in range(n):
  t,x,y=list(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())
T = []
XY = []


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


cx, cy = 0, 0
ct = 0
for _ in range(N):
    t, x, y = list(map(int, input().split()))
    d = f(cx, cy, x, y)
    # print(f'{ct=}, {t=}, {d=}')
    if d > t - ct:
        print('No')
        return
    if (t - ct - d) % 2 != 0:
        print('No')
        return
    cx, cy = x, y
    ct = t
print('Yes')


'''
Created on 2020/08/31

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  N=int(pin())
  time=0
  nx=0
  ny=0
  for i in range(N):
    t,x,y=list(map(int,pin().split()))
    d=abs(nx-x)+abs(ny-y)
    s=t-time
    if d<=s and s%2==d%2:
      time=t
      nx=x
      ny=y
    else:
      print("No")
      return
  print("Yes")
  return
main()
#kaisetuAC


n = int(input())
px = py = pt = 0
for i in range(n):
	t,x,y = map(int,input().split())
	d = abs(x - px) + abs(y - py)
	nt = t - pt
	if nt < d or d%2 != nt%2:
		print("No")
		return
	px = x
	py = y
	pt = t
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")
    return
  t=txy[i][0]
print("Yes")

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

# coding: utf-8


def main():
    N = int(input())
    ans = 'Yes'
    t, x, y = 0, 0, 0
    for _ in range(N):
        nt, nx, ny = list(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)

def __starting_point():
    main()

__starting_point()

n = int(input())
s = [list(map(int,input().split())) for i in range(n)]
stand = [0,0]
prev = 0

for t,x,y in s:
    diff = abs(x+y-sum(stand))
    walk = t-prev
    if diff<=walk and walk%2==diff%2:
        stand=[x,y]
        prev = t
    else:
        print('No')
        break
else:
    print('Yes')


N = int(input())
t0, x0, y0 = 0, 0, 0
for i in range(N):
    t, x, y = list(map(int, input().split()))
    kyori = abs(x - x0) + abs(y - y0)
    time = abs(t0 - t)
    if abs(kyori - time) % 2 == 0 and time - kyori >= 0:
        t0, x0, y0 = t, x, y
    else:
        print('No')
        return
print('Yes')


N = int(input())

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

for i in range(N):
    if i == 0:
        if (a[i][0] - a[i][1] - a[i][2]) % 2 != 0 or (a[i][0] - a[i][1] - a[i][2]) < 0:
            print("No")
            return
    else:
        if (a[i][0] - a[i][1] - a[i][2]) % 2 != 0 or (a[i][0]- a[i-1][0]) -( (a[i-1][1] + a[i-1][2] )-(a[i][1] + a[i][2])) < 0:
            print("No")
            return
print("Yes")

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

ans = 'Yes'
for i in range(N):
  dt = t_x_y[i+1][0] - t_x_y[i][0]
  dist = abs(t_x_y[i+1][1] - t_x_y[i][1]) + abs(t_x_y[i+1][2] - t_x_y[i][2])
  
  if dt < dist:
    ans = 'No'
    break
  else:
    # dt >= dist
    if (dt - dist) % 2 != 0:
      ans = 'No'
      break
  
print(ans)

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

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)

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

  



#!/user/bin/env pypy3
import sys
from typing import NamedTuple, List


def fast_input():
    return sys.stdin.readline()[:-1]


class Position(NamedTuple):
    t: int
    x: int
    y: int

    def _calc_diff_move(self, position) -> int:
        diff_x = self.x - position.x
        diff_y = self.y - position.y
        return abs(diff_x) + abs(diff_y)

    def can_move_from(self, prev) -> bool:
        diff_t = self.t - prev.t
        diff_move = self._calc_diff_move(prev)
        # 奇数のときはその場禁止
        if not diff_t % 2 == diff_move % 2:
            return False
        return diff_t >= diff_move


def result_format(b: bool) -> str:
    return "Yes" if b else "No"


def solve(positions: List[Position]) -> bool:
    positions = [Position(t=0, x=0, y=0)] + positions
    for p_ind in range(len(positions) - 1):
        p_curr = positions[p_ind]
        p_next = positions[p_ind + 1]
        if not p_next.can_move_from(p_curr):
            return False
    return True


def main():
    n = int(fast_input())
    positions = []
    for _ in range(n):
        t, x, y = list(map(int, fast_input().split()))
        positions.append(Position(t=t, x=x, y=y))
    result = solve(positions)
    print((result_format(result)))


main()


cnt = int(input())

t_s, x_s, y_s = 0, 0, 0
for _ in range(cnt):
  t, x, y = map(int, input().split())
  d_t, d_x, d_y = t-t_s, x-x_s, y-y_s
  z = abs(d_x + d_y)
  if z > d_t or (d_t - z)%2 == 1:
    print("No")
    break
  t_s, x_s, y_s = t, x, y
else:
  print("Yes")

n=int(input())
location=list(map(str,[input() for i in range(n)]))
fail=0
for j in range(n):
    if j==0:
        a=[0,0,0]
    else:
        a=list(map(int, location[j-1].split()))
    b=list(map(int,location[j].split()))
    x=abs(a[1]-b[1])
    y=abs(a[2]-b[2])
    t=b[0]-a[0]
    if x+y<=t:
        if (x+y)%2==t%2:
            pass
        else:
            fail+=1
    else:
        fail+=1
if fail==0:
    print("Yes")
else:
    print("No")

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

T=[0]*N
dist=[0]*N

for i in range(N):
	T[i]=P[i+1][0]-P[i][0]
	dist[i]=abs(P[i+1][1]-P[i][1])+abs(P[i+1][2]-P[i][2])

ans=1
for i in range(N):
	if dist[i]>T[i]:
		ans=0
	else:
		m=T[i]-dist[i]
		if m%2==0:
			pass
		else:
			ans=0
	if ans==0:
		break
print("Yes" if ans==1 else "No")

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())
rx = 0
ry = 0
rt = 0
ok = True
for _ in range(n):
    t, x, y = map(int, input().split())
    dist = abs(x-rx) + abs(y-ry)
    #print(dist)
    if dist <= abs(t-rt) and (abs(t-rt)-dist)%2 == 0:
        rx = x
        ry = y
        rt = t
    else: ok = False

if ok: print("Yes")
else: print("No")

n=int(input())
arr=[[0,0,0]]+[list(map(int,input().split())) for _ in range(n)]
for i in range(n):
  t1,x1,y1=arr[i]
  t2,x2,y2=arr[i+1]
  if abs(x1-x2)+abs(y1-y2)>t2-t1:
    print('No')
    return
  if (abs(x1-x2)+abs(y1-y2))%2!=(t2-t1)%2:
    print('No')
    return
print('Yes')

Row = int(input())
List = []
for i in range (Row):
  List.append(list(map(int, input().split())))
x = 0
y = 0
T = 0
flag = True
for i in range(Row):
  reqT = abs(List[i][1]-x)+abs(List[i][2]-y)
  chck= List[i][0] - T - reqT
  if chck < 0 or chck % 2 == 1:
    flag = False
    break
  x = List[i][1]
  y = List[i][2]
  T = List[i][0]
if flag:
  print("Yes")
else:
  print("No")

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

pT, pX, pY = 0, 0, 0

for i in range(N):
    cT, cX, cY = l[i]
    mvT, mvX, mvY = abs(cT-pT), abs(cX-pX), abs(cY-pY)
    
    dam = mvT - (mvX+mvY)

    if dam %2 == 1 or dam < 0:
        print('No')
        return

    pT, pX, pY = l[i]

print('Yes')



N = int(input())
pt, px, py = 0, 0, 0
can = True
for i in range(N):
    t, x, y = map(int, input().split())
    T, X, Y = t - pt, abs(x - px), abs(y - py)
    if T < X + Y or T % 2 != (X + Y) % 2:
        can = False
    pt, px, py = t, x, y
print('Yes' if can else 'No')

N=int(input())
t=[0]
x=[0]
y=[0]
for _ in range(N):
    a,b,c=list(map(int,input().split()))
    t.append(a)
    x.append(b)
    y.append(c)

for i in range(N):
    X=abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
    T=abs(t[i+1]-t[i])
    if X>T or X%2!=T%2:
        print("No")
        break
else:
    print("Yes")


N = int(input())

plan = []

Feasible = True

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

t0,x0,y0 = 0,0,0

for t1,x1,y1 in plan:
  dx = x1-x0
  dy = y1-y0
  dt = t1-t0
  dist = abs(dx)+abs(dy)
  d = dt - dist
  
  if dt < dist:
    Feasible = False
  elif (dist+dt)%2 != 0:
    Feasible = False
  t0,x0,y0 = t1,x1,y1
print("Yes" if Feasible else "No")

n = int(input())
pt,px,py = 0, 0, 0

for _ in range(n):
  ct,cx,cy = map(int,input().split())
  t = ct - pt
  d = abs(cx-px) + abs(cy-py)
  if t < d or (t%2) != (d%2):
    print('No')
    break
  pt,px,py = ct,cx,cy
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")
        return

print("Yes")

# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N = z()
T, X, Y = [], [], []
pos_x, pos_y, now_t = 0, 0, 0
for i in range(N):
    t, x, y = zz()
    T.append(t)
    X.append(x)
    Y.append(y)
ok = 1
for t, x, y in zip(T, X, Y):
    if (abs(x - pos_x) + abs(y - pos_y) > (t - now_t)):
        ok = 0
        break
    if (((abs(x - pos_x) + abs(y - pos_y)) % 2) != ((t - now_t) % 2)):
        ok = 0
        break
    pos_x, pos_y, now_t = x, y, t
if(ok == 1):
    print('Yes')
else:
    print('No')


n=int(input())
txylist=[[0,0,0]]
for i in range(n):
    txy=list(map(int,input().split(" ")))
    txylist+=[txy]
for i in range(n):
    p=False
    t0,x0,y0=txylist[i]
    t1,x1,y1=txylist[i+1]
    t,x,y=t1-t0,x1-x0,y1-y0
    tt=abs(x)+abs(y)
    legs=t-tt
    if legs>=0 and legs%2==0:
        p=True
    else:
        print("No")
        break
if p==True:
    print("Yes")