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, X, Y = 0, 0, 0

for _ in range(N):
    t, x, y = map(int, input().split())
    a = t - T
    b = abs(X - x)
    c = abs(Y - y)

    if a < b + c or a % 2 != (b + c) % 2:
        print('NO')
        exit()
    T, X, Y = t, x, y

print('YES')
N = int(input())
T, X, Y = 0, 0, 0

for _ in range(N):
    t, x, y = list(map(int, input().split()))
    a = t - T
    b = abs(X - x)
    c = abs(Y - y)

    if a < b + c or a % 2 != (b + c) % 2:
        print('No')
        exit()
    T, X, Y = t, x, y

print('Yes')