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.
import sys
N=int(input())
t0=0
x0,y0=0,0
dt=0
dx,dy,d=0,0,0
for i in range(N):
    t,x,y=map(int,input().split())
    dt=t-t0
    dx=x-x0
    dy=y-y0
    d=abs(dx)+abs(dy)
    if d>t or dt%2!=d%2:
        print("NO")
        sys.exit()
    else:
        t0=t
        x0=x
        y0=y
print("YES")
import sys
N=int(input())
t0=0
x0,y0=0,0
dt=0
dx,dy,d,n=0,0,0,0
for i in range(N):
    t,x,y=map(int,input().split())
    dt=t-t0
    dx=x-x0
    dy=y-y0
    d=abs(dx)+abs(dy)
    if d>t or dt%2!=d%2:
        n=n+1
    else:
        t0=t
        x0=x
        y0=y
if n>=1:
    print("No")
else:
    print("Yes")