N = int(eval(input()))

In = [list(map(int, input().split())) for _ in range(N)]



s = (0, 0)

t = 0

success = True



for move in In:

    before_x, before_y = s

    tn, after_x, after_y = move



    dist_xy = abs(after_x - before_x) + abs(after_y - before_y)

    walk = tn - t



    if walk < dist_xy:

        success *= False



    if walk % 2 == 0 and dist_xy % 2 != 0:

        success *= False

    elif walk % 2 != 0 and dist_xy % 2 == 0:

        success *= False



    s = (after_x, after_y)

    t = tn



print(("Yes" if success else "No"))
N = int(eval(input()))

In = [list(map(int, input().split())) for _ in range(N)]



s = (0, 0)

t = 0

success = True



for move in In:

    before_x, before_y = s

    tn, after_x, after_y = move



    dist_xy = abs(after_x - before_x) + abs(after_y - before_y)

    walk = tn - t



    if walk < dist_xy:

        success *= False

        break



    if walk % 2 == 0 and dist_xy % 2 != 0:

        success *= False

        break

    elif walk % 2 != 0 and dist_xy % 2 == 0:

        success *= False

        break



    s = (after_x, after_y)

    t = tn



print(("Yes" if success else "No"))
N = int(eval(input()))
In = [list(map(int, input().split())) for _ in range(N)]
s = (0, 0)
t = 0
success = True
for move in In:
    before_x, before_y = s
    tn, after_x, after_y = move
    dist_xy = abs(after_x - before_x) + abs(after_y - before_y)
    walk = tn - t
    if walk < dist_xy:
        success *= False
    if walk % 2 == 0 and dist_xy % 2 != 0:
        success *= False
    elif walk % 2 != 0 and dist_xy % 2 == 0:
        success *= False
    s = (after_x, after_y)
    t = tn
print(("Yes" if success else "No"))

N = int(eval(input()))
In = [list(map(int, input().split())) for _ in range(N)]
s = (0, 0)
t = 0
success = True
for move in In:
    before_x, before_y = s
    tn, after_x, after_y = move
    dist_xy = abs(after_x - before_x) + abs(after_y - before_y)
    walk = tn - t
    if walk < dist_xy:
        success *= False
        break
    if walk % 2 == 0 and dist_xy % 2 != 0:
        success *= False
        break
    elif walk % 2 != 0 and dist_xy % 2 == 0:
        success *= False
        break
    s = (after_x, after_y)
    t = tn
print(("Yes" if success else "No"))

+        break +        break +        break