integer N
integer t_pre,x_pre,y_pre!previousのつもりだけどpresentにもとれる、、、
integer t,x,y
integer check
read*,N

t_pre=0;x_pre=0;y_pre=0
check=1
do i=1,N
  read*,t,x,y
  if(abs(x-x_pre)+abs(y-y_pre)>t-t_pre)check=0
  if(mod(abs(x+y-(x_pre+y_pre)),2)/=mod(t-t_pre,2))check=0
end do
print"(A)",merge("Yes"," No",check==1)
end