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.
n = int(input().split()[0])

txy_list = []

for i in range(0, n):
    work_list = list(map(int, input().split()))
    txy_list.append(work_list)

pre_txy = [0, 0, 0]
answer = False

for txy in txy_list:
    t, x, y = txy[0], txy[1], txy[2]
    pre_t, pre_x, pre_y = pre_txy[0], pre_txy[1], pre_txy[2]

    t_w, x_w, y_w = t - pre_t, abs(x - pre_x), abs(y - pre_y)
    work = t_w - (x_w + y_w)

    if (work % 2 == 0) and (work >= 0):
        pre_txy = txy
        continue
    else:
        break
else:
    answer = True

a = 'YES' if answer else 'NO'
print(a)


n = int(input().split()[0])

txy_list = []

for i in range(0, n):
    work_list = list(map(int, input().split()))
    txy_list.append(work_list)

pre_txy = [0, 0, 0]
answer = False

for txy in txy_list:
    t, x, y = txy[0], txy[1], txy[2]
    pre_t, pre_x, pre_y = pre_txy[0], pre_txy[1], pre_txy[2]

    t_w, x_w, y_w = t - pre_t, abs(x - pre_x), abs(y - pre_y)
    work = t_w - (x_w + y_w)

    if (work % 2 == 0) and (work >= 0):
        pre_txy = txy
        continue
    else:
        break
else:
    answer = True

a = 'Yes' if answer else 'No'
print(a)