program main
   integer, allocatable :: i(:, :)
   read(*, *)n
   allocate(i(3, 0:n))
   i(:, 0) = (/0, 0, 0/)
   read(*, *)i(:, 1:n)
   do k = 1, n
      jx = abs(i(2, k) - i(2, k - 1)) + abs(i(3, k) - i(3, k - 1)) 
      jt = i(1, k) - i(1, k - 1)
      if(jx > jt .or. ibits(jx, 0, 1) /= ibits(jt, 0, 1))then
         write(*, *) "No"
         stop
      endif
   enddo
   write(*, *)"Yes"
end
