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())
t = [0]*N
x = [0]*N
y = [0]*N
for n in range(N):
    t[n], x[n], y[n] = map(int, input().split())

ans = "Yes"
for n in range(N-1):
    dt = t[n+1] - t[n]
    dist = abs(x[n+1] - x[n]) + abs(y[n+1] - y[n])
    if (dt > dist) or (dt % 2 != dist % 2):
        ans = "No"

print(ans)
N = int(input())
t = [0]*(N+1)
x = [0]*(N+1)
y = [0]*(N+1)
t[0] = 0
x[0] = 0
y[0] = 0
for n in range(N):
  n = n+1
  t[n], x[n], y[n] = map(int, input().split())

ans = "Yes"
for n in range(N):
    dt = t[n+1] - t[n]
    dist = abs(x[n+1] - x[n]) + abs(y[n+1] - y[n])
    if (dt < dist) or ((dt - dist) % 2 == 1):
        ans = "No"

print(ans)