Problem:
 Score : 300 points    Problem Statement 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 1 2
3 1 2
6 1 1      Sample Output 1 Yes  For example, he can travel as follows: (0,0) , (0,1) , (1,1) , (1,2) , (1,1) , (1,0) , then (1,1) .       Sample Input 2 1
2 100 100      Sample Output 2 No  It is impossible to be at (100,100) two seconds after being at (0,0) .       Sample Input 3 2
5 1 1
100 1 1      Sample Output 3 No

Solution (Python):
_ = int(input())
bef_time = 0
bef_x = 0
bef_y = 0
ans = True

for i in range(_):
    next = input().split()
    next_time = int(next[0])
    next_x = int(next[1])
    next_y = int(next[2])
    time = next_time - bef_time
    range = abs(next_x - bef_x) + abs(next_y - bef_y)

    if (next_time - bef_time) < range:
        ans = False
        break

    if time % 2 == 0:
       if range % 2 != 0:
          ans = False
          break
    else:
       if range % 2 == 0 or range == 0:
          ans = False
          break

    bef_time = next_time
    bef_y = next_y
    bef_x = next_x



if ans == True:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
TXY = [list(map(int,input().split())) for _ in range(N)]

for i in range(N):
  if i == 0:
    dt = TXY[i][0]
    dx = TXY[i][1]
    dy = TXY[i][2]
  else:
    dt = TXY[i][0] - TXY[i-1][0]
    dx = TXY[i][1] - TXY[i-1][1]
    dy = TXY[i][2] - TXY[i-1][2]
  if abs(dx) + abs(dy) > dt or (dx + dy) % 2 != dt % 2:
    print("No")
    exit()
print("Yes")

Solution (Python):
N = int(input())
t = [list(map(int, input().split())) for i in range(N)]

if N == 1:
    if t[0][0] >= t[0][1] + t[0][2]:
        print("Yes")
    else:
        print("No")

else:
    for i in range(1,N):
        a = t[i][0] - t[i-1][0]
        b = abs(t[i][1] - t[i-1][1]) + abs(t[i][2] - t[i-1][2])
        if a >= b and a % 2 == b % 2:
            continue
        else:
            print("No")
            exit()
    print("Yes")

Solution (Python):
n = int(input())
t_state, x_state, y_state = 0, 0, 0
for i in range(n):
    t, x, y = map(int, input().split())
    d = abs(x - x_state) + abs(y - y_state)
    td = t - t_state
    if  td < d or td%2 != d%2:
        print("No")
        exit()
    t_state, x_state, y_state = t, x, y
print("Yes")

Solution (Python):


n = int(input())
data = [list(map(int, input().split())) for _ in range(n)]
data.insert(0, [0, 0, 0])
ans = 'Yes'

for i in range(n):
    time = data[i+1][0] - data[i][0]
    distance = abs(data[i+1][1] - data[i][1]) + abs(data[i+1][2] - data[i][2])
    if time < distance or time%2 != distance%2:
        ans = 'No'
        break

print(ans)

Solution (Python):
n = int(input())
for i in range(n):
    t, x, y = [int(x) for x in input().split()]
    if (x+y) > t or (x+y+t)%2:
        print('No')
        exit()
print('Yes')

Solution (Python):
n = int(input())
time_space = [(int(x) for x in input().split()) for i in range(n)]
pos = [0,0]
for t, x, y in time_space:
    if (x+y) > t or (x+y+t)%2:
        print('No')
        exit()
print('Yes')

Solution (Python):
n = int(input())
for i in range(n):
    t, x, y = map(int, input().split())
    if t % 2 == (x+y) % 2 and t >= (x+y):
        continue
    else:
        print('No')
        exit()
print('Yes')

Solution (Python):
N=int(input())
txy=[[0,0,0]]
for i in range(0,N):
    tmp=input().split()
    tmp=[int(s) for s in tmp]
    txy.append(tmp)
cnt=0
for i in range(0,N):
    d=abs(txy[i][1]-txy[i+1][1])+abs(txy[i][2]-txy[i+1][2])
    t=txy[i+1][0]-txy[i][0]
    if d <= t and (t-d)%2==0:
        cnt+=1
    else:
        break
if cnt==N:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())

for _ in range(N):
  t, x, y = map(int,input().split())
  if x+y>t or (t-x-y)%2:
    print("No")
    exit()
print("Yes")

Solution (Python):
N = int(input())
for i in range(N):
    t, x, y = map(int, input().split())
    if (x + y) > t or (x + y) % 2 != t % 2:
        print("No")
        exit()
print("Yes")

Solution (Python):
n=int(input())
A=[[0,0,0]]
for i in range(n):
    a=list(map(int,input().split()))
    A.append(a)
    t=A[i+1][0]-A[i][0]
    d=abs(A[i+1][1]-A[i][1])+abs(A[i+1][2]-A[i][2])
    if t<d or (t-d)%2!=0:
        print('No')
        exit()
print('Yes')

Solution (Python):
N = int(input())
pre_x = 0
pre_y = 0
pre_t = 0
for n in range(N):
  t, x, y = list(map(int, input().split()))
  length = x- pre_x + y - pre_y
  if (t - pre_t) >= length and ((t - pre_t) - length) % 2 == 0:
    continue
  else:
    print('No')
    exit(0)

print('Yes')

Solution (Python):
n = int(input())
l = [[0,0,0]]
for i in range(n):
  t,x,y = map(int, input().split())
  l.append([t,x,y])

enable = True
for i in range(1, len(l)):
  d = abs(l[i][1]-l[i-1][1]) + abs(l[i][2]-l[i-1][2])
  delta = l[i][0]-l[i-1][0]
  if delta < d or (delta - d) % 2 != 0:
    enable = False
    break
    
if enable:
  print('Yes')
else:
  print('No')

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

t,x,y = 0,0,0
ans = 'Yes'
for t1,x1,y1 in A:
    dt,dx,dy = t1-t, abs(x1-x), abs(y1-y)
    if dt>=dx+dy:
        if (dt%2==0)&((dx+dy)%2==0):
            pass
        elif (dt%2==1)&((dx+dy)%2==1):
            pass
        else:
            ans = 'No'
            break
    else:
        ans = 'No'
        break
    t,x,y = t1,x1,y1
print(ans)

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

t,x,y = 0,0,0
ans = 'Yes'
for t1,x1,y1 in A:
    dt,dx,dy = t1-t, abs(x1-x), abs(y1-y)
    if dt%(dx+dy)==0:
        pass
    else:
        ans = 'No'
        break
    t,x,y = t1,x1,y1
print(ans)

Solution (Python):
N=int(input())
true_flg = True
list=[input() for i in range(N)]
for key, element in enumerate(list):
    t, x, y = map(int, element.split())
    if key == 0:
        a = t - (abs(x) + abs(y))
        if a < 0 or a % 2 == 1:
            true_flg = False
            break
    else:
        pre_t, pre_x, pre_y = map(int, list[key-1].split())
        a = (t - pre_t) - (abs(x - pre_x) + abs(y - pre_y))
        if a < 0 or a % 2 == 1:
            true_flg = False
            break
if true_flg:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())

t0=0
x0=0
y0=0

ans="Yes"

for i in range(N):
    t,x,y=map(int,input().split())
    d=abs(x-x0)+abs(y-y0)
    dt=t-t0
    if not (d<=dt and (dt-d)%2==0):
        ans="No"
    t0=t
    x0=x
    y0=y

print(ans)

Solution (Python):
import sys
N = int(input())
t=[0]*(N+1)
x=[0]*(N+1)
y=[0]*(N+1)

dist = 0

dt = 0 

now_x =0
now_y =0

t[0] = 0
x[0] = now_x
y[0] = now_y
for i in range(1,N+1):
    t[i],x[i],y[i] = map(int, input().split())
    
for i in range(1,N+1):    
    
    dist = abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
    dt = abs(t[i] - t[i-1])
    
    if(dist > dt):
        print('No')
        sys.exit()
    else:
        
        
        if(dt %2 != dist %2):
            print('No')
            sys.exit()
    
print('Yes')

Solution (Python):
N=int(input())

t0=0
x0=0
y0=0

ans="Yes"

for i in range(N):
    t,x,y=map(int,input().split())
    d=abs(x-x0)+abs(y-y0)
    dt=t-t0
    if d>dt:
        ans="No"
    else:
        if (dt-d)%2!=0:
            ans="No"
    t0=t
    x0=x
    y0=y

print(ans)

Solution (Python):
N=int(input())

t0=0
x0=0
y0=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")
        exit()
    else:
        if ((t-t0)-d)%2!=0:
            print("No")
            exit()
    t0=t
    x0=x
    y0=y

print("Yes")

Solution (Python):
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
D = [0] * N
T = [0] * N
for i in range(N):
  t[i+1], x[i+1], y[i+1] = map(int, input().split())
for i in range(N):
  D[i] = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
  T[i] = t[i+1] - t[i]
ans = 'Yes'
for i in range (N):
  if D[i] <= T[i] and (D[i] - T[i])%2 == 0:
    ans = 'Yes'
  else:
    ans = 'No'
print(ans)

Solution (Python):

number = int(input())


result = True
current_position = (0, 0, 0)
for i in range(number):
    t, x, y = map(int, input().split())
    
    if result:
        
        move_point = (t - current_position[0])
        
        
        distance = abs(x - current_position[1]) + abs(y - current_position[2])
        
        
        if (move_point < distance) or ((move_point - distance) % 2 != 0):
            result = False
        
        
        current_position = (t, x, y)

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

Solution (Python):
n = int(input())
t = [0]
x = [0]
y = [0]
for i in range(n):
    ti, xi, yi = map(int, input().split())
    t.append(ti)
    x.append(xi)
    y.append(yi)

flag = 0
for i in range(1, n+1):
    time = t[i] - t[i-1]
    dst = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])
    if time < dst or (time - dst) % 2 == 1:
        flag = 1
if flag:
    print('No')
else:
    print('Yes')

Solution (Python):
n = int(input())
t_list = [0] * n
x_list = [0] * n
y_list = [0] * n
for i in range(n):
    t_list[i], x_list[i],y_list[i] = map(int, input().split())

prev_t, prev_x, prev_y = 0, 0, 0
for i in range(n):
    t, x, y = t_list[i], x_list[i], y_list[i]
    diff_t = t - prev_t
    diff_x = abs(x - prev_x)
    diff_y = abs(y - prev_y)
    remaining_t = diff_t - (diff_x + diff_y)
    if (remaining_t < 0) or (remaining_t % 2 != 0):
        print("No")
        exit()
    prev_t = t
    prev_x = x
    prev_y = y

print("Yes")

Solution (Python):
import sys

yomikomi_kaisuu = int(input())
no_hantei = 0

for i in range(yomikomi_kaisuu):

    input_list = input().split()
    jikoku = int(input_list[0])
    x_ = int(input_list[1])
    y_ = int(input_list[2])
    if jikoku < x_ + y_:
        no_hantei = no_hantei + 1

    elif jikoku %2 == 0 and (x_ + y_) % 2 == 1:
        no_hantei = no_hantei + 1

    elif jikoku %2 == 1 and (x_ + y_) % 2 == 0:
        no_hantei = no_hantei + 1


if no_hantei == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
txy = [list(map(int, input().split())) for _ in range(N)]
txy.sort(key=lambda x: x[0])
now = 0, 0, 0
for t, x, y in txy:
    dist = x - now[1] + y - now[2]
    if not (t - now[0] >= dist and (t - now[0]) % 2 == dist % 2):
        print("No")
        break
    now = t, x, y
else:
    print("Yes")

Solution (Python):
N = int(input())

t_prev = 0
x_prev = 0
y_prev = 0

ans = "Yes"

for i in range(N):
  t_now, x_now, y_now = map(int, input().split())
  t_diff = abs(t_now - t_prev)
  x_diff = abs(x_now - x_prev)
  y_diff = abs(y_now - y_prev)
  
  t_prev = t_now
  x_prev = x_now
  y_prev = y_now
  
  if t_diff < x_diff + y_diff:
    ans = "No"
    
  if t_diff % 2 != (x_diff + y_diff) % 2:
    ans = "No"
    
print(ans)

Solution (Python):
N = int(input())
txy = [list(map(int, input().split())) for _ in range(N)]
result = True

for pol in txy:
    dist = abs(pol[1]) + abs(pol[2])
    
    if(dist > pol[0]): result = False
    if(dist % 2 != pol[0] % 2): result = False

print(("No", "Yes")[result])

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

for i in range(N):
    dt = txy[i + 1][0] - txy[i][0]
    dist = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2])
    
    if(dist > dt): result = False
    if(dist % 2 != dt % 2): result = False

print(("No", "Yes")[result])

Solution (Python):
N = int(input())
for i in range(N):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t)%2 != 0:
    print("No")
    exit()
print("Yes")

Solution (Python):
N = int(input())

t_b = x_b = y_b = 0 

def dist(x, x_b, y, y_b):
    return abs(x-x_b) + abs(y-y_b)

miss_flg = 0

for i in range(N):
    t, x, y = map(int, input().split())
    if dist(x, x_b, y, y_b) > t - t_b or ((t - t_b) + dist(x, x_b, y, y_b))% 2 == 1: 
        miss_flg = 1
    t_b, x_b, y_b = t, x, y

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

Solution (Python):
n = int(input())
breaker = 0
for s in range(n):
	a = [int(i) for i in input().split()]
	tour = a[1] + a[2]
	if tour > a[0]:
		breaker += 1
	elif tour % 2 != a[0] % 2:
		breaker += 1
	if breaker != 0:
		print("No")
		break
if breaker == 0:
	print("Yes")

Solution (Python):
N = int(input().strip())
Q = [list(map(int, input().strip().split(' '))) for _ in range(N)]

now = [0,0,0]  
for t,x,y in Q:
  dt = t-now[0]
  dxy = abs(now[1]-x) + abs(now[2]-y)
  if dt >= dxy and dt%2 == dxy%2:
    now = [t,x,y]
  else:
    print('No')
    exit()
print('Yes')

Solution (Python):

import numpy as np
n = int(input())
l = [list(map(int,input().split())) for _ in range(n)]

if n == 1:
    if l[0][0] >= l[0][1]+l[0][2]:
        if l[0][0]%2 == (l[0][1]+l[0][2])%2:
            pass
        else:
            print('No')
            exit()    
    else:
        print('No')
        exit()
for i in range(n-1):
    t = l[i+1][0]-l[i][0]
    x = abs(l[i+1][1]-l[i][1])
    y = abs(l[i+1][2]-l[i][2])
    if t >= x+y:
        if t%2 == (x+y)%2:
            pass
        else:
            print('No')    
            exit()
    else:
        print('No')
        exit()
print('Yes')

Solution (Python):

import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N = int(input())
        txy = [list(map(int, input().split())) for _ in range(N)]

        t, x, y = 0, 0, 0

        for next in txy:
            time = next[0] - t
            x_d = abs(next[1] - x)
            y_d = abs(next[2] - y)
            if x_d + y_d > time or (x_d + y_d) % 2 != time % 2:
                print('No')
                exit()
            t, x, y = next

        print('Yes')



if __name__ == '__main__':
    AtCoder().main()

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

for i in range(N):
    time = txy[i + 1][0] - txy[i][0]
    length = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2])
    if time >= length and time % 2 == length % 2:
        continue
    else:
        print('No')
        exit()
print('Yes')

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    TXY = [[0,0,0]]
    for i in range(N):
        tmp = list(map(int,input().split()))
        TXY.append(tmp)
    TXY = sorted(TXY)
    flag = 0
    
    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 not (abs(dt)%2 == (abs(dx)+abs(dy))%2 and abs(dt) >= abs(dx)+abs(dy)):
            flag = 1
            break
            
    if flag == 1:
        print("No")
    else:
        print("Yes")

    
    
main()

Solution (Python):
N=int(input())
ans="Yes"
for _ in range(N):
  t,x,y=map(int,input().split())
  if t<x+y or t%2!=(x+y)%2:
    ans="No"
print(ans)

Solution (Python):
N=int(input())
li=[list(map(int,input().split())) for _ in range(N)]
li.insert(0,[0,0,0])
ans="Yes"
for i in range(N):
  if li[i+1][0]-li[i][0]<abs(li[i+1][1]-li[i][1])+abs(li[i+1][2]-li[i][2]) or (li[i+1][0]-li[i][0])%2!=abs(li[i+1][1]-li[i][1]+li[i+1][2]-li[i][2])%2:
    ans="No"
print(ans)

Solution (Python):
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):
    if abs(T[i-1] - T[i]) < abs(X[i-1] - X[i]) + abs(Y[i-1] - Y[i]):
        print('No')
        exit()
    else:
        if T[i] % 2 != 0 and (X[i]+Y[i]) % 2 == 0:
            print('No')
            exit()
        elif T[i] % 2 == 0 and (X[i]+Y[i]) % 2 != 0:
            print('No')
            exit()

print('Yes')

Solution (Python):
import sys
n = int(input())
t = []; x = []; y = []
for i in range(n):
    tmp_t, tmp_x, tmp_y = map(int, input().split())
    t.append(tmp_t)
    x.append(tmp_x)
    y.append(tmp_y)

if n == 1:
    if x[0] + y[0] == 1:
        print("Yes")
    else:
        print("No")
    sys.exit(0)

prex, prey, pre_t = 0, 0, 0
for i in range(n):
    m = abs(x[i] - prex) + abs(y[i] - prey)
    time = t[i] - pre_t
    if m <= time and m % 2 == time % 2:
        prex, prey, pre_t = x[i], y[i], t[i]
    else:
        print("No")
        break

else:
    print("Yes")

Solution (Python):
import sys
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
ans = "Yes"
tpre, xpre, ypre = 0, 0, 0
for _ in range(n):
    t, x, y = na()
    move = abs(x - xpre) + abs(y - ypre) 
    time = (t - tpre)
    if move <= time and move % 2 == time % 2:
        continue
    else:
        ans = "No"

    tpre, xpre, ypre = t, x, y
print(ans)

Solution (Python):
def func():
    N = int(input())
    data = [list(map(int, input().split())) for i in range(N)]

    now = [0, 0, 0]
    flg = True
    for t, x, y in data:
        dt = t - now[0]
        dx = abs(x-now[1])
        dy = abs(y-now[2])
        
        if dt == dx + dy or ((dt >= (dx + dy))and(dt - (dx + dy)) % 2 == 0):
            now[0] = t
            now[1] = x
            now[2] = y
        
        else:
            flg = False
            break
    
    if flg:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    func()

Solution (Python):
N = int(input())
t = [0]
x = [0]
y = [0]
for _ in range(N):
    T, X, Y = map(int, input().split())
    t.append(T)
    x.append(X)
    y.append(Y)
    
bool = 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:
        bool = False
    elif dist%2 != dt%2:
        bool = False
        
if bool == True:
    print('Yes')
else:
    print('No')

Solution (Python):
for _ in[0]*int(input()):
	t,x,y=map(int,input().split())
	if(t+x+y)%2+(t<x+y):print("No");exit()
print("Yes")

Solution (Python):
def solve():
	_,*l=map(int,open(0).read().split())
	print("YNeos"[any((t+x+y)%2+(t<x+y)for t,x,y in zip(*[iter(l)]*3))::2])

if __name__=="__main__":
	solve()

Solution (Python):
_,*l=map(int,open(0).read().split());print("YNeos"[any((t+x+y)%2+(t<x+y)for t,x,y in zip(*[iter(l)]*3))::2])

Solution (Python):
n,*l=map(int,open(0).read().split());print("YNeos"[any((i+j+k)%2+(i<j+k)for i,j,k in zip(*[iter([abs(i-j)for i,j in zip([0,0,0]+l,l)])]*3))::2])

Solution (Python):
n=int(input())
t_l,x_l,y_l=[0],[0],[0]
for i in range(n):
    t,x,y=map(int,input().split())
    t_l.append(t)
    x_l.append(x)
    y_l.append(y)

for i in range(n):
    a = (t_l[i+1]-t_l[i]) - (abs(x_l[i+1]-x_l[i]) + abs(y_l[i+1]-y_l[i]))
    if a<0 or a%2!=0:
        print('No')
        exit()
print('Yes')

Solution (Python):
n = int(input())
txy = [[0,0,0]] + [list(map(int, input().split())) for _ in range(n)]
for i in range(1,n+1):
  dist = abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2]) 
  diffTime = txy[i][0] - txy[i-1][0]
  if not (diffTime >= dist and abs(diffTime - dist) % 2 == 0):
    print("No")
    exit()
print("Yes")

Solution (Python):
N = int(input())

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

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

isCan = True

for i in range(N):
    dt = t[i+1] - t[0]
    dx = x[i+1] - x[0]
    dy = y[i+1] - y[0]
    dgrid = abs(dx) + abs(dy)
    test = dt - dgrid
    if test < 0:
        isCan = False
        break
    elif test % 2 == 0:
        isCan = True
    else:
        isCan = False
        break

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

Solution (Python):
N = int(input())
txy = [[int(i) for i in input().split()] for _ in range(N)]

def solve() :
    pt, px, py = 0, 0, 0
    for t, x, y in txy :
        dd = abs(x-px) + abs(y-py)
        dt = t - pt
        if dd > dt or dd % 2 != dt % 2 :
            return 'No'
            
        pt, px, py = t, x, y
        
    return 'Yes'
    
print(solve())

Solution (Python):
import sys
n = int(input())
t_1=0
t_2=0
x_1=0
x_2=0
y_1=0
y_2=0

for i in range (n):
    t_1,x_1,y_1=t_2,x_2,y_2
    t_2,x_2,y_2=map(int,input().split())
    if (t_2-t_1) >= abs(x_2-x_1)+abs(y_2-y_1) and (t_2-t_1)%2 == (abs(x_2-x_1)+abs(y_2-y_1))%2:
        continue
    else:
        print('No')
        sys.exit()
print('Yes')

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


n = I()
L = [[0, 0, 0]] + LIR(n)
for i in range(n):
    t, x, y = L[i]
    nxt_t, nxt_x, nxt_y = L[i+1]
    if nxt_t - t < abs(nxt_x - x) + abs(nxt_y - y) or (abs(nxt_x - x) + abs(nxt_y - y) - nxt_t - t) % 2:
        print('No')
        break
else:
    print('Yes')

Solution (Python):
n = int(input())
txy = [[0, 0, 0]]
for _ in range(n):
    txy.append(list(map(int, input().split())))

for i in range(1, n + 1):
    t = txy[i][0] - txy[i-1][0]
    x = txy[i][1] - txy[i-1][1]
    y = txy[i][2] - txy[i-1][2]
    mv = abs(x) + abs(y)
    if mv > t or (mv - t) % 2 == 1:
        print("No")
        break

else:
    print("Yes")

Solution (Python):
n = int(input())
t=[0]*(n+1)
x=[0]*(n+1)
y=[0]*(n+1)
cnt = 0
for i in range(1,n+1):
  t[i],x[i],y[i] = list(map(int,input().split()))
  dt = t[i]-t[i-1]
  dr = abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
  if dt%2==dr%2 and dt >= dr:
    continue
  else:
    print('No')
    cnt = 1
    break
if cnt==0:
  print('Yes')

Solution (Python):
N = int(input())

t = [0]
x = [0]
y = [0]
for i in range(N):
    t1, x1, y1 = [int(j) for j in input().split()]
    t.append(t1)
    x.append(x1)
    y.append(y1)

count = 0
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 dist > dt:
        break
    elif dt%2 != dist%2:
        break
    else:
        count += 1

if count == N:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())

for i in range(n):
  t, x, y = map(int, input().split())
  if(x+y) > t or (t+x+y) % 2:
      print("No")
      exit()
print("Yes")

Solution (Python):
import sys
import math
from fractions import gcd





def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""


 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())


 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

N = int(sys.stdin.readline())
list_travel=  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]

x_now = 0
y_now = 0
time_now = 0

ans = 'Yes'

for i in range(N):
    
    
    
    time_next, x_next, y_next = list_travel[i]
    dis_delta = abs(x_next - x_now) + abs(y_next - y_now)
    time_delta = time_next - time_now
    if(dis_delta <= time_delta
    and (dis_delta - time_delta)%2 == 0):
        x_now = x_next
        y_now = y_next
        time_now = time_next
    else:
        ans = 'No'

print(ans)

Solution (Python):
import sys
import math
from fractions import gcd





def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""


 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())


 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

N = int(sys.stdin.readline())
list_travel=  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]

x_now = 0
y_now = 0
time_now = 0

ans = 'Yes'

for i in range(N):
    time_next = list_travel[i][0]
    x_next = list_travel[i][1]
    y_next = list_travel[i][2]
    
    dis_delta = abs(x_next - x_now) + abs(y_next - y_now)
    time_delta = time_next - time_now
    if(dis_delta <= time_delta
    and (dis_delta - time_delta)%2 == 0):
        x_now = x_next
        y_now = y_next
        time_now = time_next
    else:
        ans = 'No'

print(ans)

Solution (Python):
N = int(input())

t, x, y = [0]*(N+1), [0]*(N+1), [0]*(N+1)
t[0] = 0
x[0] = 0
y[0] = 0
result = "Yes"

def is_even(num):
    return num % 2 == 0

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

for i in range(1, N+1):
    time = t[i] - t[i-1]
    xlen = abs(x[i] - x[i-1])
    ylen = abs(y[i] - y[i-1])
    distance = xlen+ylen
    if is_even(time) == is_even(distance) and distance <= time:
        continue
    result = "No"
    break
    
print(result)

Solution (Python):
n = int(input())
list_plan = []
for i in range(n):
    t, x, y = map(int, input().split())
    list_plan.append([t, x, y])

for i in list_plan:
    t, x, y = i[0], i[1], i[2]
    if x + y <= t and (t - x - y)%2 == 0:
        pass
    else:
        print("No")
        exit()

print("Yes")

Solution (Python):
import sys
input=sys.stdin.readline
T=[0]
X=[0]
Y=[0]
cnt=0

N=int(input())
for i in range(N):
	t_,x_,y_=[int(i) for i in input().split()]
	T.append(t_)
	X.append(x_)
	Y.append(y_)

def delta_p(l):
	return abs(X[l]-X[l-1])+abs(Y[l]-Y[l-1])
def delta_t(l):
	return T[l]-T[l-1]
	
for t in range(1,N+1):

	if cnt !=0:
		break
	if delta_p(t)>delta_t(t) or delta_p(t)%2!=delta_t(t)%2:
			cnt+=1
	else:
		continue

print('Yes' if cnt==0 else'No')

Solution (Python):
n=int(input())
for _ in range(n):
    t, x, y = map(int, input().split())
    if  x + y > t or (t -x -y) % 2:
        print("No")
        exit() 
print("Yes")

Solution (Python):
n = int(input())
 
for _ in range(n):
    t, x, y = map(int, input().split())
    if  x + y > t or (t - x - y) % 2:
        print("No")
        exit()
print("Yes")

Solution (Python):
N=int(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")

Solution (Python):
n=int(input())
txy=[[int(i) for i in input().split()] for j in range(n)]

x=0
y=0
ans=True
for i in range(n):
    if abs(txy[i][1]-x)+abs(txy[i][2]-y)<=txy[i][0] and (txy[i][0]-(abs(txy[i][1]-x)+abs(txy[i][2]-y)))%2==0:
        ans=True
    else:
        ans=False
        break
print('Yes' if ans else 'No')

Solution (Python):
import numpy as np

N = int(input())
t = [0]*N
x = [0]*N
y = [0]*N
for i in range(N):
    t[i],x[i],y[i] = map(int,input().split())
if t[0] >= x[0]+y[0]:
    pass
else:
    print('No')
    exit()
if (t[0]+x[0]+y[0]) % 2 == 0:
    pass
else:
    print('No')
    exit()
t = np.diff(t)
x = np.diff(x)
y = np.diff(y)

for a,b,c in zip(t,x,y):
    if a >= abs(b)+abs(c):
        pass
    else:
        print('No')
        exit()
    if (abs(a)+abs(b)+abs(c)) % 2 == 0:
        pass
    else:
        print('No')
        exit()
print('Yes')

Solution (Python):
import math
import sys

n = int(input())

for i in range(n):
	t,x,y = map(int, sys.stdin.readline().split())
	d = abs(x)+abs(y)

	if d > t or (d - t) % 2 != 0:
		print('No')
		exit()

print('Yes')

Solution (Python):
import math
import sys

n = int(input())

for i in range(n):
	t,x,y = map(int, input().split())
	d = abs(x)+abs(y)

	if d > t or (d - t) % 2 != 0:
		print('No')
		exit()

print('Yes')

Solution (Python):
N = int(input())
T = 0
X = 0
Y = 0
flag = True

for i in range(N):
	t, x, y = map(int, input().split())
	d = abs(X - x) + abs(Y - y)
	if t - T < d or (t - T) % 2 != d % 2:
		flag = False
		break
	else:
		T = t
		X = x
		Y = y

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

Solution (Python):
N = int(input())

current = 0, 0, 0
for _ in range(N):
	t, x, y = map(int, input().split())
	t_diff = t - current[0]
	d_diff = abs(x-current[1]) + abs(y-current[2])
	if t_diff < d_diff:
		print('No')
		break
	elif (d_diff - t_diff)%2 != 0:
		print('No')
		break
	current = t, x, y
else:
	print('Yes')

Solution (Python):
n=int(input())
L=[0]*3
f=True
for i in range(n):
  S=list(map(int,input().split()))
  if S[0]-L[0]<abs(S[1]-L[1])+abs(S[2]-L[2]):
    f=False
    break
  elif (S[0]-L[0]-(abs(S[1]-L[1])+abs(S[2]-L[2])))%2!=0:
    f=False
    break
  L=S
print('Yes' if f else 'No')

Solution (Python):
import sys
import math
from fractions import gcd





def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""


 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())


 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


N =  int(sys.stdin.readline())
L =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]

current = [0, 0, 0]
for l in L:
    if l[0] < abs(current[1] - l[1]) + abs(current[2] - l[2]):
        print("No")
        exit()
    if (l[0] - current[0]) % 2 != (abs(current[1] - l[1]) + abs(current[2] - l[2])) % 2:
        print("No")
        exit()
    current = l[:]
print("Yes")

Solution (Python):
class AtCoDeer:
    def __init__(self):
        self.pos = {"x": 0, "y": 0}
        self.time = 0

    def move(self, to_x, to_y):
        self.pos = {"x": to_x, "y": to_y}
        return self.pos

    def can_move(self, t, to_x, to_y):
        dx = abs(to_x-self.pos.get("x"))
        dy = abs(to_y-self.pos.get("y"))
        total_move = dx + dy
        dt = t - self.time

        if dt < total_move:
            return False
        elif (dt-total_move) % 2 != 0:
            return False
        else:
            self.move(to_x, to_y)
            self.time = t
            return True


def main():
    n = int(input())
    at_co_deer = AtCoDeer()

    while(at_co_deer.can_move(*[int(x) for x in input().split()])):
        n -= 1
        if n == 0:
            break
    
    
    for i in range(n-1):
        input()

    if n == 0:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()