CodeEff/ECCO huggingface dataset:
# Original solution
n = int(input())
travel = [list(map(int, input().split())) for i in range(n)]

accessible_now = [(0,0)]
limit = 1e5 + 1

stroke = 0
for target in travel:
  t, x, y = target
  while (stroke<t):
    stroke += 1
    accessible_next = [] 
    for loc in accessible_now:
      for step in [(1,0),(0,1),(-1,0),(0,-1)]:
        loc_next = (loc[0]+step[0],loc[1]+step[1])
        if ((-1 in loc_next) or (limit in loc_next)):
          continue
        if (loc_next in accessible_next):
          continue
        accessible_next.append(loc_next)
    accessible_now = accessible_next
    #print stroke, t, accessible_now
    if (stroke == t):
      if ((x,y) in accessible_now):
        accessible_now = [(x,y)]
        continue
      else:
        print('No')
        exit(0) 
res = 'Yes' if (stroke==t) else 'No'
print(res)


# Optimized solution
n = int(input())
travel = [list(map(int, input().split())) for i in range(n)]

loc = (0,0)
now = 0
res = 'Yes'

for dest in travel:
  t, x, y = dest
  minpath = abs(x-loc[0]) + abs(y-loc[1])
  tmp = (t-now)-minpath
  if (tmp%2==0 and tmp>=0 ):
    loc = (x,y)
    now = t
    continue
  else:
    res = 'No'
    break
print(res)
# Original solution
N = int(eval(input()))
ans = "Yes"
x = 0
y = 0
t = 0
for i in range(N):
    t_i,x_i,y_i = list(map(int,input().split()))
    x_i = abs(x_i-x)
    y_i = abs(y_i-x)
    t_i = abs(t_i-t)
    
    if x_i+y_i <= t_i and (x_i+y_i-t_i)%2 == 0:
        continue
    else:
        ans = "No"

print(ans)

# Optimized solution
N = int(eval(input()))
ans = "Yes"
x = 0
y = 0
t = 0
for i in range(N):
    t_i,x_i,y_i = list(map(int,input().split()))
    x_i = abs(x_i-x)
    y_i = abs(y_i-x)
    t_i = abs(t_i-t)
    
    if x_i+y_i <= t_i and (x_i+y_i-t_i)%2 == 0:
        continue
    else:
        ans = "No"
    x = x_i
    y = y_i
    t = t_i

print(ans)
# Original solution
N = int(eval(input()))

ans = "Yes"
a = 0
b = 0
T = 0
for _ in range(N):
    t,x,y = list(map(int, input().split()))
    if abs(a-x)+abs(b-y) <= t-T and (abs(a-x)+abs(b-y))%2 == (t-T)%2:
        a = x
        b = y
        T = t
    else:
        ans = "No"

print(ans)

# Optimized solution
N = int(eval(input()))
ans = "Yes"
X = 0
Y = 0
T = 0
for _ in range(N):
    t,x,y = list(map(int, input().split()))
    dt = t-T
    d = abs(X-x)+abs(Y-y)-dt
    if d > 0 or d%2 == 1:
        ans = "No"
    T = t
    X = x
    Y = y

print(ans)
# Original solution
n = int(eval(input()))
txy = [list(map(int, input().split())) for i in range(n)]

for i in range(n):
    if i == 0:
        ti, xi, yi = 0, 0, 0
    else:
        ti, xi, yi = txy[i-1]
    tf,xf,yf = txy[i]
    dt = tf - ti
    dx = abs(xi-xf)
    dy = abs(yi-yf)

    if dt < dx + dy or (dt-(dx+dy))%2 != 0:
        print("No")
        exit()
print("Yes")


# Optimized solution
n = int(eval(input()))
for i in range(n):
    t, x, y = list(map(int, input().split()))
    if x+y > t or (x+y+t) % 2!=0:
        print("No")
        exit()
print("Yes")
# Original solution
N = int(eval(input()))
txy = [0]*(N+1)
txy[0] = [0, 0, 0]
for i in range(1, N + 1):
    txy[i] = [int(i) for i in input().split()]

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

# Optimized solution
N = int(eval(input()))
now = [0, 0, 0]

for i in range(N):
    t, x, y = list(map(int, input().split()))
    dis = abs(x-now[0]) + abs(y - now[1])
    if (t - now[2]) < dis:
        print('No')
        break
    elif ((t - now[2]) - dis) % 2 != 0:
        print('No')
        break
else:
    print('Yes')
# Original solution
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from math import floor, ceil, sqrt, factorial, log
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
from itertools import product
import sys
stdin = sys.stdin
mod = 10**9 + 7


def ns(): return stdin.readline().rstrip()


def ni(): return int(ns())


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


n = ni()
tnow, xnow, ynow = 0, 0, 0
for _ in range(n):
    t, x, y = na()
    l = abs(xnow - x) + abs(ynow - y)
    if (t - tnow) < l or (t - tnow) % 2 != l % 2:
        print("No")
        quit()
print("Yes")


# Optimized solution
import sys
stdin = sys.stdin
from itertools import accumulate, groupby
mod = 10**9 + 7

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

n = ni()
tp, xp, yp = 0, 0, 0
for _ in range(n):
    t, x, y = na()
    ta, l = t-tp, abs(x - xp) + abs(y - yp)
    if ta >= l and ta % 2 ==l % 2:
        continue
    else:
        print("No")
        quit()
print("Yes")
# Original solution
N = int(eval(input()))
pnt = [[0]*3]
for i in range(N):
  pnt.append(list(map(int, input().split())))
cnt = 0
for i in range(1, N+1):
  t = pnt[i][0] - pnt[i-1][0]
  x = abs(pnt[i][1] - pnt[i-1][1])
  y = abs(pnt[i][2] - pnt[i-1][2])
  if t >= x+y and (t-(x+y)) % 2 == 0:
    cnt += 1
if cnt == N: print("Yes")
else: print("No")


# Optimized solution
n = int(eval(input()))
ti_1, xi_1, yi_1 = [0,0,0]
for i in range(n):
  ti, xi, yi = list(map(int, input().split()))
  tlim = ti- ti_1
  dist = abs(xi - xi_1) + abs(yi - yi_1)
  if tlim < dist or (tlim-dist) % 2 == 1:
    print('No')
    exit()
  else:
    ti_1, xi_1, yi_1 = ti, xi, yi
    continue
print('Yes')
# Original solution
n = int(eval(input()))
plcs = [list(map(int,input().split())) for _ in range(n)]
A = [0, 0, 0]
for i in range(n):
    A = [plcs[i][j] - A[j] for j in range(3)]
    if A[0] >= abs(A[1]) + abs(A[2]) and plcs[i][0] % 2 == (abs(plcs[i][1]) + abs(plcs[i][2])) % 2:
        continue
    else:
        print('No')
        exit()
print('Yes')

# Optimized solution
n = int(eval(input()))
TP = [[0, 0, 0]]
for _ in range(n):
    TP.append(list(map(int, input().split())))
for i in range(1, n + 1):
    td = TP[i][0] - TP[i-1][0]
    pd = abs(TP[i][1] - TP[i-1][1]) + abs(TP[i][2] - TP[i-1][2])
    if td >= pd and td % 2 == pd % 2:
        continue
    else:
        print('No')
        exit()
print('Yes')
# Original solution
N = int(eval(input()))
t = [0 for i in range(N + 1)]
x = [0 for i in range(N + 1)]
y = [0 for i in range(N + 1)]
for i in range(N):
    t[i + 1], x[i + 1], y[i + 1] = list(map(int, input().split()))
flag = 1
for i in range(N):
    dl = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
    dt = t[i + 1] - t[i]
    if dl > dt or (dl - dt) % 2 == 1:
        flag = 0
        break
if flag == 1:
    print("Yes")
else:
    print("No")


# Optimized solution
N=int(eval(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]=list(map(int,input().split()))
flag=1
for i in range(N):
    dl = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
    dt = t[i + 1] - t[i]
    if dl > dt or (dl - dt) % 2 == 1:
        flag = 0
        break
if flag == 1:
    print("Yes")
else:
    print("No")
# Original solution
def BlCannotGo(dt, dx, dy): ## 行けないならTrue
    if (dt % 2) != ((dx + dy) % 2) or (dx + dy) > dt:
        return True
    else:
        return False

if __name__ == '__main__':
    n = int(eval(input()))
    l = list(list(map(int, input().split())) for _ in range(n))

    dt = l[0][0]
    dx = l[0][1]
    dy = l[0][2]
    if BlCannotGo(dt, dx, dy):
        print('No')    
        exit()
        
    for i in range(1,n):
        dt = l[i][0] -  l[i-1][0] 
        dx = l[i][1] -  l[i-1][1]
        dy = l[i][2] -  l[i-1][2]
        if BlCannotGo(dt, dx, dy):
            print('No')    
            exit()

    print('Yes')

# Optimized solution
def BlCannotGo(dt, dx, dy): ## 行けないならTrue
    dist = dx + dy
    if (dt % 2) != (dist % 2) or dist > dt:
        return True
    else:
        return False

def abs(x):
    if x>=0:
        return x
    else:
        return -x

if __name__ == '__main__':
    n = int(eval(input()))
    t = list(False for _  in range(n+1))
    x = list(False for _  in range(n+1))
    y = list(False for _  in range(n+1))
    t[0], x[0], y[0] = 0, 0, 0
    for i in range(n):
        t[i+1], x[i+1], y[i+1] = list(map(int, input().split()))

    for i in range(1,n+1):
        dt = t[i] -  t[i-1]
        dx = abs(x[i] -  x[i-1])
        dy = abs(y[i] -  y[i-1])
        if BlCannotGo(dt, dx, dy):
            print('No')    
            exit()

    print('Yes')
# Original solution
def BlCannotGo(dt, dx, dy): ## 行けないならTrue
    dist = dx + dy
    if (dt % 2) != (dist % 2) or dist > dt:
        return True
    else:
        return False

def abs(x):
    if x>=0:
        return x
    else:
        return -x

if __name__ == '__main__':
    n = int(eval(input()))
    t = list(False for _  in range(n+1))
    x = list(False for _  in range(n+1))
    y = list(False for _  in range(n+1))
    t[0], x[0], y[0] = 0, 0, 0
    for i in range(n):
        t[i+1], x[i+1], y[i+1] = list(map(int, input().split()))

    for i in range(1,n+1):
        dt = t[i] -  t[i-1]
        dx = abs(x[i] -  x[i-1])
        dy = abs(y[i] -  y[i-1])
        if BlCannotGo(dt, dx, dy):
            print('No')    
            exit()

    print('Yes')


# Optimized solution
def main():
    n = int(eval(input()))

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


if __name__ == '__main__':
    main()
# Original solution
def main():
    n = int(eval(input()))

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


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    import sys
    input = sys.stdin.readline

    N = int(eval(input()))

    pt, px, py = 0, 0, 0
    for _ in range(N):
        t, x, y = list(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()
# Original solution
N = int(eval(input()))
p = [list(map(int, input().split())) for _ in range(N)]
ans = True
for i in range(N):
    if p[i][1] + p[i][2] > p[i][0]:
        ans = False
        break
    if (p[i][1] + p[i][2]) % 2 != p[i][0] % 2:
        ans = False
        break
if ans:
    print("Yes")
else:
    print("No")


# Optimized solution
N = int(eval(input()))
for i in range(N):
    t, x, y = list(map(int, input().split()))
    if x + y > t or (x + y) % 2 != t % 2:
        print("No")
        exit()
print("Yes")
# Original solution
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(eval(input()))
from collections import defaultdict, Counter

t = [ list(map(int, input().split())) for _ in range(N)]
diff = lambda a,b : abs(a[0] - b[0]) + abs(a[1] - b[1])

pos = (0,0)
tim = 0

for i in range(N):
    distance = diff(pos, t[i][1:])
    dis_time = t[i][0] - tim
    if not dis_time % 2 == distance %2 or not dis_time>=distance:
        print("No")
        exit(0)
print("Yes")
exit(0)

# d = defaultdict(int)
# 
# for _ in range(N):
#     s = input()
#     d[s[0]] += 1

# print(d)

ans = 0
charlist = list("MARCH")
for i in range(1<<5):
    if not Counter( list ( "{0:05b}".format(i)) )["1"] == 3:
        continue
    
    s = 1
    for e,i in enumerate(list("{0:05b}".format(i))):
        if i == "1":
            s *= d[ charlist[e] ]

    ans += s
print(ans)
    


# Optimized solution
N=int(eval(input()))
nt=0
np=(0,0)
ok=True
for t,x,y in [list(map(int,input().split())) for _ in range(N)]:
  el,nt=t-nt,t
  dist=abs(np[0]-x)+abs(np[1]-y)
  
  if el<dist: 
    ok=False 
    break
  if (el-dist)%2!=0:
    ok=False 
    break
  np=(x,y)
if ok:
  print("Yes")
else:
  print("No")
# Original solution
n=int(eval(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)

# Optimized solution
n=int(eval(input()))
a=[list(map(int,input().split())) for _ in range(n)]
x=y=t=0
ans='Yes'
for i in range(n):
  c=a[i]
  xy=c[1]+c[2]-(x+y)
  if xy>c[0]-t:
    ans='No'
    break
  else:
    if xy%2!=(c[0]-t)%2:
      ans='No'
      break
    elif abs(c[1]-x)+abs(c[2]-y)>c[0]-t:
      ans='No'
      break
  x=c[1]
  y=c[2]
  t=c[0]
print(ans)
# Original solution
# -*- coding: utf-8 -*-

n = int(eval(input()))
t_bef, x_bef, y_bef, flag = 0, 0, 0, 0
travel = []
for i in range(n):
    travel.append([int(x) for x in input().split()])

for j in travel:
    t, x, y = j[0], j[1], j[2]
    check = (t - t_bef) - abs(x_bef - x) - abs(y_bef - y)
    t_bef, x_bef, y_bef = t, x, y
    if check < 0:
        print('No')
        flag = 1
        break
    if check % 2 != 0:
        print('No')
        flag = 1
        break
if flag == 0:
    print('Yes')

# Optimized solution
# -*- coding: utf-8 -*-

n = int(eval(input()))
t_bef, x_bef, y_bef, flag = 0, 0, 0, 0
travel = []
for i in range(n):
    t, x, y = [int(x) for x in input().split()]
    check = (t - t_bef) - abs(x_bef - x) - abs(y_bef - y)
    t_bef, x_bef, y_bef = t, x, y
    if check < 0:
        print('No')
        flag = 1
        break
    if check % 2 != 0:
        print('No')
        flag = 1
        break
if flag == 0:
    print('Yes')
# Original solution
n = int(eval(input()))
t = [0]
x = [0]
y = [0]
for i in range(n):
  t_, x_, y_ = list(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 = abs(x[j+1] - x[j])
  dy = abs(y[j+1] - y[j])
  if dx+dy>dt or dt%2!=(dx+dy)%2:
    print('No')
    exit()
    
print('Yes')

# Optimized solution
n=int(eval(input()))
t=0
x=0
y=0
for i in range(n):
  t_,x_,y_=list(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')
# Original solution
#!/usr/bin/env python
"""AtCoder Beginner Contest 086: C - Traveling
https://atcoder.jp/contests/abc086/tasks/arc089_a
"""

__author__ = 'bugttle <bugttle@gmail.com>'


def main():
    N = int(eval(input()))
    position = {'t': 0, 'x': 0, 'y': 0}

    answer = 'Yes'
    for _ in range(N):
        t, x, y = list(map(int, input().split()))
        # print('x:' + str(abs(x-position['x'])))
        # print('y:' + str(abs(y-position['y'])))
        # print('t:' + str(t - position['t']))
        # print(abs(x-position['x']) + abs(y-position['y']))
        length = abs(x-position['x']) + abs(y-position['y'])
        t_d = t - position['t']
        if length <= t_d and length % 2 == t_d % 2:
            position = {'t': t, 'x': x, 'y': y}
        else:
            answer = 'No'
            break

    print(answer)


if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python
"""AtCoder Beginner Contest 086: C - Traveling
https://atcoder.jp/contests/abc086/tasks/arc089_a
"""

__author__ = 'bugttle <bugttle@gmail.com>'


def main():
    N = int(eval(input()))
    current = {'t': 0, 'x': 0, 'y': 0}

    answer = 'Yes'
    for _ in range(N):
        t, x, y = list(map(int, input().split()))
        length = abs(x-current['x']) + abs(y-current['y'])
        t_d = t - current['t']
        # t=1: odd, t=2: even, t=3: odd, t=4: even, ...
        if length <= t_d and length % 2 == t_d % 2:
            current = {'t': t, 'x': x, 'y': y}
        else:
            answer = 'No'
            break

    print(answer)


if __name__ == '__main__':
    main()
# Original solution
N=int(eval(input()))
txy=[list(map(int,input().split())) for i in range(N)]
ans=0
for i in range(N):
    t,x,y=txy[i][0],txy[i][1],txy[i][2]
    if x+y<=t and t%2==(x+y)%2:ans+=1
print(("Yes" if ans==N else "No"))

# Optimized solution
N=int(eval(input()))
count=0
for i in range(N):
    t,x,y=list(map(int,input().split()))
    if x+y<=t and t%2==(x+y)%2:count+=1
print(("Yes" if count==N else "No"))
# Original solution
def dif(two_lists):
    return [abs(two_lists[1][i] - two_lists[0][i]) for i in range(3)]


n = int(eval(input()))

txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]
dtxy = list(map(dif, list(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")


# Optimized solution
import sys
def dif(two_lists):
    return [abs(two_lists[1][i] - two_lists[0][i]) for i in range(3)]


n = int(eval(input()))

txy = [[0, 0, 0]] + [[int(s) for s in line.split()] for line in sys.stdin]
dtxy = list(map(dif, list(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")
# Original solution
import sys

n = int(eval(input()))
before_t, before_x, before_y = 0, 0, 0
for i in range(n):
	txy_strs = input().split()
	t, x, y = tuple(map(int, txy_strs))
	
	movable = t - before_t
	min_move = abs(x - before_x) + abs(y - before_y)

	remaining = movable - min_move
	if 0 <= remaining and remaining % 2 == 0:
		before_t, before_x, before_y = t, x, y
	else:
		print("No")
		sys.exit()
print("Yes")

# Optimized solution

import sys

n = int(sys.stdin.readline())
before_t, before_x, before_y = 0, 0, 0
for i in range(n):
	txy_strs = sys.stdin.readline().split()
	t, x, y = tuple(map(int, txy_strs))

	movable = t - before_t
	min_move = abs(x - before_x) + abs(y - before_y)

	remaining = movable - min_move
	if 0 <= remaining and remaining % 2 == 0:
		before_t, before_x, before_y = t, x, y
	else:
		print("No")
		sys.exit()
print("Yes")
# Original solution
N = int(eval(input()))
I = [[int(i) for i in input().split()] for j in range(N)]

current, time = (0, 0), 0
for i in range(N):
    dist = abs(current[0] - I[i][1]) + abs(current[1] - I[i][2])
    if dist > I[i][0] - time or (I[i][0]- time - dist) % 2 == 1:
        print("No")
        break
    current, time = (I[i][1], I[i][2]), I[i][0]
else:
    print("Yes")

# Optimized solution
import sys

def solve():
    N = int(eval(input()))
    cx, cy = 0, 0
    nt = 0
    for _ in range(N):
        t, x, y = list(map(int, input().split()))
        rem = t - nt - abs(x - cx) - abs(y - cy)
        if rem < 0 or rem % 2 > 0:
            print("No")
            break
        cx, cy = x, y
        nt = t
    else: print("Yes")
        
    return 0

if __name__ == "__main__":
    solve()
# Original solution
# -*- coding: utf-8 -*-
def compare(x):
  return x[0]


def find(x, lst):
  for value in lst:
    if value[0] == x:
      return True
  return False


n = int(input())
lst = [[0, 0, 0]]
for i in range(n):
  lst.append(list(map(int, input().split())))
lst.sort(key=compare)
x = lst[len(lst) - 1][0]
for i in range(1, x):
  if not find(i, lst):
    lst.append([i, -1, -1])
lst.sort(key=compare)

points = [[0, 0]]
flg = False
try:
  for i in range(1, x + 1):
    fix = False
    wk = []
    for point in points:
      wk.append((point[0] + 1, point[1]))
      wk.append((point[0] - 1, point[1]))
      wk.append((point[0], point[1] + 1))
      wk.append((point[0], point[1] - 1))
      wk = list(set(wk))

      ps = (lst[i][1], lst[i][2])
      x = point[0]
      y = point[1]
      if (i == lst[i][0]) and (x >= 0) and (y >= 0) and ((x + 1, y) == ps or (x - 1, y) == ps or (x, y + 1) == ps or (x, y - 1) == ps):
        flg = True
        wk = [ps]
        break
    points = list(set(wk))
    if (i == lst[i][0]) and (lst[i][1] >= 0) and (not flg):
      break
finally:
  print('Yes') if flg else print('No')


# Optimized solution
# -*- coding: utf-8 -*-
n = int(input())
points = []
for i in range(n):
  points.append(list(map(int, input().split())))

flg = False
for point in points:
  flg = (point[0] >= (point[1] + point[2])) and ((point[0] % 2 == 1) and ((point[1] + point[2]) % 2 == 1) or (point[0] % 2 == 0) and ((point[1] + point[2]) % 2 == 0))
  if not flg:
    break
print('Yes') if flg else print('No')
# Original solution
import sys
can = True; eval(input())
e = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]
for a, b in zip(e[1:], e):
    t = a[0] - b[0] - abs(a[1] - b[1]) - abs(a[2] - b[2])
    if t < 0 or t % 2 == 1: can = False; break
print((['No', 'Yes'][can]))

# Optimized solution
import sys
ans = 'Yes'; eval(input())
for e in sys.stdin:
    t, x, y = list(map(int, e.split()))
    t = t - x - y
    if t < 0 or t % 2 == 1: ans = 'No'; break
print(ans)
# Original solution
N = int(eval(input()))
T = 0
X = 0
Y = 0
ans = 'Yes'
for i in range(N):
  t, x, y = list(map(int, input().split()))
  if abs(X-x)+abs(Y-y)>abs(T-t) or (((X-x)+(Y-y))-(T - t))%2==1:
    ans = 'No'
  else:
    T = t
    X = x
    Y = y
    
print(ans)

# Optimized solution
N = int(eval(input()))
xc, yc, tc = 0, 0, 0
ans = 'Yes'
for i in range(N):
  t, x, y = list(map(int, input().split()))
  if (t - tc - abs(x-xc) - abs(y-yc)) % 2 == 0 and t - tc - abs(x-xc) - abs(y-yc) >= 0:
    xc, yc, tc = x, y, t
  else:
    ans = 'No'
    break
print(ans)
# Original solution
N = int(eval(input()))
txys = [list(map(int, input().split())) for _ in range(N) ]
txys.insert(0, [0, 0, 0])

for i in range(N):
    t1, x1, y1 = txys[i]
    t2, x2, y2 = txys[i+1]
    dt = t2 - t1
    tIsEven = dt % 2 == 0
    dist = abs(x1 - x2) + abs(y1 - y2)
    xyIsEven = dist % 2 == 0
    if tIsEven != xyIsEven or dist > dt:
        print("No")
        exit()
print("Yes")



# Optimized solution
N = int(eval(input()))
txys = [list(map(int, input().split())) for _ in range(N) ]
txys.insert(0, [0, 0, 0])

for i in range(N):
    t1, x1, y1 = txys[i]
    t2, x2, y2 = txys[i+1]
    dt = t2 - t1
    dist = abs(x1 - x2) + abs(y1 - y2)
    if dt % 2 != dist % 2 or dist > dt:
        print("No")
        exit()
print("Yes")
# Original solution
n = int(eval(input()))
l = []
for i in range(n):
    t,x,y = list(map(int,input().split()))
    l.append([t,x,y])
for i in range(n):
    t,x,y = l[i][0],l[i][1],l[i][2]
    if x+y > t or (t-(x+y))%2 != 0:
          print('No')
          exit()
l.sort()
for i in range(n-1):
    t,x,y = l[i][0],l[i][1],l[i][2]
    t_,x_,y_ = l[i+1][0],l[i+1][1],l[i+1][2]
    if t_ - t < (abs(x-x_)+abs(y-y_)):
        print('No')
        exit()
print('Yes')

# Optimized solution
n = int(eval(input()))
l = [[0,0,0]]
for i in range(n):
    t,x,y = list(map(int,input().split()))
    l.append([t,x,y])
for i in range(n):
    t,x,y = l[i][0],l[i][1],l[i][2]
    t_,x_,y_ = l[i+1][0],l[i+1][1],l[i+1][2]
    if t_ - t < (abs(x-x_)+abs(y-y_)) or (t_-t-(abs(x-x_)+abs(y-y_)))%2 != 0:
        print('No')
        exit()
print('Yes')
# Original solution
def dist(x,y):
    return abs(x[0]-y[0])+abs(x[1]-y[1])
N = int(eval(input()))
X = [list(map(int,input().split())) for _ in range(N)]
flag = 0
t1,x1,y1 = 0,0,0
for i in range(N):
    t2,x2,y2 = X[i]
    d = dist((x1,y1),(x2,y2))
    dt = t2-t1
    if dt>=d and (dt-d)%2==0:
        t1,x1,y1 = X[i]
    else:
        flag=1
        break
if flag==0:
    print("Yes")
else:
    print("No")

# Optimized solution
def dist(x,y):
    return abs(x[0]-y[0])+abs(x[1]-y[1])
N = int(eval(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")