AtCoder Beginner Contest 086 - Traveling

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.

-----Constraints-----
 - 1 ≤ N ≤ 10^5
 - 0 ≤ x_i ≤ 10^5
 - 0 ≤ y_i ≤ 10^5
 - 1 ≤ t_i ≤ 10^5
 - t_i < t_{i+1} (1 ≤ i ≤ N-1)
 - All input values are integers.

-----Input-----
Input is given from Standard Input in the following format:
N
t_1 x_1 y_1
t_2 x_2 y_2
:
t_N x_N y_N

-----Output-----
If AtCoDeer can carry out his plan, print Yes; if he cannot, print No.

-----Sample Input-----
2
3 1 2
6 1 1

-----Sample Output-----
Yes

For example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).

Source: atcoder | Difficulty: EASY


Solutions:
N = int(input())
for i in range(N):
	(t, x, y) = map(int, input().split())
	if x + y > t or (x + y + t) % 2:
		print('No')
		exit()
print('Yes')


(n, *l) = map(int, open(0).read().split())
print('YNeos'[any(((i + j + k) % 2 + (i < j + k) for (i, j, k) in zip(*[iter([abs(i - j) for (i, j) in zip([0, 0, 0] + l, l)])] * 3)))::2])


N = int(input())
(x, y) = (0, 0)
b = False
for _ in range(N):
	(T, X, Y) = map(int, input().split())
	if abs(X - x) + abs(Y - y) > T or abs(X - x) + abs(Y - y) + T & 1:
		b = True
print('YNeos'[b::2])


(t, x, y) = (0, 0, 0)
for i in range(int(input())):
	(t_n, x_n, y_n) = map(int, input().split())
	diff = abs(x - x_n) + abs(y - y_n)
	if diff > t_n - t or (t_n - t - diff) % 2 == 1:
		print('No')
		return
	(t, x, y) = (t_n, x_n, y_n)
print('Yes')


N = int(input())
txn = []
for i in range(N):
	txn.append([int(i) for i in input().split()])
ima = [0, 0, 0]
for i in range(N):
	dist = abs(ima[1] - txn[i][1]) + abs(ima[2] - txn[i][2])
	if dist > txn[i][0] - ima[0]:
		print('No')
		return
	if dist % 2 != (txn[i][0] - ima[0]) % 2:
		print('No')
		return
	ima = txn[i]
print('Yes')


def solve():
	(_, *l) = map(int, open(0).read().split())
	print('YNeos'[any(((t + x + y) % 2 + (t < x + y) for (t, x, y) in zip(*[iter(l)] * 3)))::2])
solve()


N = int(input())
for _ in range(N):
	(t, x, y) = map(int, input().split())
	if x + y > t or (t + x + y) % 2 != 0:
		print('No')
		quit()
print('Yes')


N = int(input())
(t, x, y) = (0, 0, 0)
s = 0
for i in range(N):
	(tn, xn, yn) = map(int, input().split())
	if (tn - t - (xn - x + yn - y)) % 2 == 1 or tn - t - (xn - x + yn - y) < 0:
		s = 1
if s == 0:
	print('Yes')
else:
	print('No')


n = int(input())
(dt, dx, dy) = (0, 0, 0)
for i in range(n):
	(t, x, y) = map(int, input().split())
	if abs(x - dx) + abs(y - dy) > t - dt or (x + y) % 2 != t % 2:
		print('No')
		break
	(dt, dx, dy) = (t, x, y)
else:
	print('Yes')


N = int(input())
A = [[0, 0, 0]]
for i in range(N):
	A.append(list(map(int, input().split())))
flag = True
for i in range(N):
	if not flag:
		break
	time = int(A[i + 1][0]) - int(A[i][0])
	dist = abs(A[i + 1][1] - A[i][1]) + abs(A[i + 1][2] - A[i][2])
	if time < dist:
		flag = False
	elif time % 2 != dist % 2:
		flag = False
if flag:
	print('Yes')
else:
	print('No')


from sys import exit
n = int(input())
ans = 0
for q in range(n):
	(limit, x, y) = map(int, input().split())
	if limit < x + y or (limit - x - y) % 2:
		print('No')
		exit(0)
print('Yes')


N = int(input())
px = 0
py = 0
pt = 0
for _ in range(N):
	(T, X, Y) = (int(i) for i in input().split())
	d = abs(X - px + Y - py)
	dt = T - pt
	if d > dt or d % 2 != dt % 2:
		print('No')
		import sys
		return
	else:
		px = X
		py = Y
		pt = T
print('Yes')


import sys
N = int(input())
d = [list(map(int, input().split())) for l in range(N)]
d.insert(0, [0, 0, 0])

def get_length(l1, l2):
	return abs(l1[1] - l2[1]) + abs(l1[2] - l2[2])
for cnt in range(N):
	length = get_length(d[cnt], d[cnt + 1])
	time = abs(d[cnt][0] - d[cnt + 1][0])
	if length <= time and abs(time - length) % 2 == 0:
		pass
	else:
		print('No')
		return
print('Yes')


N = int(input())
t = [0]
x = [0]
y = [0]
for _ in range(N):
	(a, b, c) = list(map(int, input().split()))
	t.append(a)
	x.append(b)
	y.append(c)
for i in range(N):
	X = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
	T = abs(t[i + 1] - t[i])
	if X > T or X % 2 != T % 2:
		print('No')
		break
else:
	print('Yes')


N = int(input())
(t, x, y) = (0, 0, 0)
s = 0
for i in range(N):
	(a, b, c) = map(int, input().split())
	(p, q) = (a - t, abs(b - x) + abs(c - y))
	if p < q or p % 2 != q % 2:
		s = 1
		break
	(t, x, y) = (a, b, c)
print('No' if s else 'Yes')


n = int(input())
(num, a, b) = (0, 0, 0)
for i in range(n):
	(t, x, y) = map(int, input().split())
	(num, a, b) = (abs(t - num), abs(x - a), abs(y - b))
	su = a + b
	if num >= su and num % 2 == su % 2:
		ans = 'Yes'
	else:
		ans = 'No'
		break
print(ans)


n = int(input())
flg = 0
for i in range(n):
	(t, x, y) = map(int, input().split())
	if x + y > t:
		print('No')
		exit()
	if x + y < t:
		if (x + y) % 2 != t % 2:
			print('No')
			exit()
print('Yes')


n = int(input())
inix = 0
iniy = 0
for _ in range(n):
	(t, x, y) = map(int, input().split())
	dist = abs(x - inix) + abs(y - iniy)
	if t < dist or (t + dist) % 2 != 0:
		print('No')
		break
else:
	print('Yes')


N = int(input())
(t, x, y) = (0, 0, 0)
ans = 'Yes'
for i in range(N):
	(T, X, Y) = map(int, input().split())
	r = abs(X - x) + abs(Y - y)
	t = T - t
	if r % 2 != t % 2 or t < r:
		ans = 'No'
		break
	t = T
	x = X
	y = Y
print(ans)


n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
a.insert(0, [0, 0, 0])
for i in range(n):
	b = a[i + 1][0] - a[i][0]
	c = abs(a[i + 1][1] + a[i + 1][2] - a[i][1] - a[i][2])
	if b < c or b % 2 != c % 2:
		print('No')
		break
else:
	print('Yes')


n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]
txy = [[0, 0, 0]] + txy
for i in range(n):
	move = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2])
	time = txy[i + 1][0] - txy[i][0]
	if time % 2 ^ move % 2 == 1 or time < move:
		print('No')
		return
print('Yes')


N = int(input())
ans = 'Yes'
for i in range(N):
	(t, x, y) = map(int, input().split())
	if t < x + y or (t + x + y) % 2 == 1:
		ans = 'No'
		break
print(ans)


import sys
n = int(input())
for i in range(n):
	(t, x, y) = map(int, input().split())
	if x + y > t or (x + y + t) % 2 == 1:
		print('No')
		sys.exit()
print('Yes')


n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
count = 0
for i in range(n):
	(t, x, y) = (l[i][0], l[i][1], l[i][2])
	if t >= x + y and t % 2 == (x + y) % 2:
		count += 1
print('Yes' if count == n else 'No')


n = int(input())
a = []
for i in range(n):
	a.append(list(map(int, input().split())))
for i in a:
	if i[0] < i[1] + i[2] or sum(i) % 2:
		print('No')
		exit()
print('Yes')


N = int(input())
ans = 'Yes'
i = 0
while i < N:
	(t, x, y) = [int(num) for num in input().split()]
	if x + y <= t and (t - x - y) % 2 == 0:
		i += 1
	else:
		ans = 'No'
		break
print(ans)


n = int(input())
s = 0
p = 0
for _ in range(n):
	(t, x, y) = map(int, input().split())
	s = t - s
	p = abs(x + y - p)
	if s < p:
		print('No')
		exit()
	elif s % 2 != p % 2:
		print('No')
		exit()
print('Yes')


N = int(input())
txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]
check = True
for i in range(1, N + 1):
	K = txy[i][0] - txy[i - 1][0]
	tmp = K - abs(sum(txy[i][1:]) - sum(txy[i - 1][1:]))
	if tmp < 0 or tmp % 2 == 1:
		check = False
		break
print('Yes' if check else 'No')


n = int(input())
a = [0] * (n + 1)
a[0] = [0, 0, 0]
for i in range(n):
	a[i + 1] = list(map(int, input().split()))
flag = True
for i in range(n):
	if abs(a[i + 1][1] - a[i][1]) + abs(a[i + 1][2] - a[i][2]) > a[i + 1][0] - a[i][0]:
		flag = False
	elif (abs(a[i + 1][1] - a[i][1]) + abs(a[i + 1][2] - a[i][2]) - (a[i + 1][0] - a[i][0])) % 2 == 1:
		flag = False
if flag:
	print('Yes')
else:
	print('No')


(r, n) = ('Yes', int(input()))
for _ in range(n):
	(t, x, y) = map(int, input().split())
	if t < x + y or t % 2 != (x + y) % 2:
		r = 'No'
print(r)


N = int(input())
t = [0]
x = [0]
y = [0]
for i in range(N):
	l = [int(c) for c in input().split()]
	t.append(l[0])
	x.append(l[1])
	y.append(l[2])
for i in range(N):
	move = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
	time = t[i + 1] - t[i]
	if time % 2 ^ move % 2 == 1 or time < move:
		print('No')
		return
print('Yes')


n = int(input())
t_pre = 0
x_pre = 0
y_pre = 0
for i in range(n):
	(t, x, y) = list(map(int, input().split()))
	if t - t_pre < abs(x - x_pre) + abs(y - y_pre):
		print('No')
		break
	if t % 2 != (x + y) % 2:
		print('No')
		break
	t_pre = t
	x_pre = x
	y_pre = y
	if i == n - 1:
		print('Yes')


N = int(input())
T = []
XY = []
ans = 'Yes'
for i in range(N):
	(t, x, y) = map(int, input().split())
	T.append(t)
	XY.append([x, y])
if T[0] >= abs(XY[0][0]) + abs(XY[0][1]) and T[0] % 2 == (abs(XY[0][0]) + abs(XY[0][1])) % 2:
	None
else:
	ans = 'No'
for i in range(1, N):
	dT = T[i] - T[i - 1]
	dX = abs(XY[i][0] - XY[i - 1][0])
	dY = abs(XY[i][1] - XY[i - 1][1])
	if dT >= dX + dY and dT % 2 == (dX + dY) % 2:
		None
	else:
		ans = 'No'
print(ans)


N = int(input())
now = [0, 0]
for i in range(N):
	(t, x, y) = map(int, input().split())
	time = abs(x - now[0]) + abs(y - now[1])
	if t >= time and (t - time) % 2 == 0:
		continue
	print('No')
	quit()
print('Yes')


N = int(input())
flag = True
for i in range(N):
	(t, x, y) = map(int, input().split())
	if x + y > t or t % 2 != (x + y) % 2:
		flag = False
		break
print('Yes' if flag else 'No')


N = int(input())
t = [0] * (N + 1)
x = [0] * (N + 1)
y = [0] * (N + 1)
for i in range(N):
	(t[i + 1], x[i + 1], y[i + 1]) = map(int, input().split())
f = True
for i in range(N):
	dt = t[i + 1] - t[i]
	dist = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
	if dt < dist:
		f = False
	if dist % 2 != dt % 2:
		f = False
print('Yes' if f else 'No')


N = int(input())
x = y = 0
for i in range(N):
	(t, nx, ny) = map(int, input().split())
	d = abs(nx - x) + abs(ny - y)
	if t < d or (t - d) % 2 == 1:
		print('No')
		break
else:
	print('Yes')


N = int(input())
flag = 1
for i in range(N):
	(t, x, y) = map(int, input().split())
	if (x + y) % 2 != t % 2 or x + y > t:
		flag = 0
if flag:
	print('Yes')
else:
	print('No')


import math
import sys
n = int(input())
for i in range(n):
	(t, x, y) = map(int, sys.stdin.readline().split())
	d = abs(x) + abs(y)
	if d > t or (d - t) % 2 != 0:
		print('No')
		exit()
print('Yes')


N = int(input())
ans = 'Yes'
(pt, px, py) = (0, 0, 0)
for i in range(N):
	(t, x, y) = map(int, input().split())
	fg = abs(t - pt) - (abs(x - px) + abs(y - py))
	if fg % 2 != 0 or fg < 0:
		ans = 'No'
		break
	(pt, px, py) = (t, x, y)
print(ans)


N = int(input())
cnt = 0
(T, X, Y) = (0, 0, 0)
for i in range(N):
	(t, x, y) = map(int, input().split())
	if abs(X - x) + abs(Y - y) <= t - T and t % 2 == (x + y) % 2:
		cnt += 1
	(T, X, Y) = (t, x, y)
print('Yes' if cnt == N else 'No')


n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]
(u, v, w) = (0, 0, 0)
for (t, x, y) in txy:
	p = t - u
	q = abs(v - x) + abs(w - y)
	if p < q or p % 2 != q % 2:
		print('No')
		break
else:
	print('Yes')


n = int(input())
(pt, px, py) = (0, 0, 0)
for _ in range(n):
	(t, x, y) = map(int, input().split())
	d = abs(x - px) + abs(y - py)
	if d > t - pt or (d + t - pt) % 2 != 0:
		print('No')
		return
	(pt, px, py) = (t, x, y)
print('Yes')


N = int(input())
t = []
x = []
y = []
for i in range(N):
	txy = list(map(int, input().split()))
	t.append(txy[0])
	x.append(txy[1])
	y.append(txy[2])
now_x = 0
now_y = 0
now_time = 0
isOK = True
for i in range(N):
	dist = (x[i] - now_x) ** 2 + (y[i] - now_y) ** 2
	time = t[i] - now_time
	if dist <= time ** 2 and dist % 2 == time % 2:
		now_x = x[i]
		now_y = y[i]
		now_time = t[i]
	else:
		isOK = False
		break
if isOK:
	print('Yes')
else:
	print('No')


n = int(input())
for i in range(n):
	(t, x, y) = map(int, input().split())
	if t % 2 == (x + y) % 2 and t >= x + y:
		continue
	else:
		print('No')
		exit()
print('Yes')


n = int(input())
txy = [tuple(map(int, input().split(' '))) for i in range(n)]
for txy_i in txy:
	(t, x, y) = txy_i
	remain = t - x - y
	if not (0 <= remain and remain % 2 == 0):
		print('No')
		exit()
print('Yes')


N = int(input())
res = True
(pre_t, pre_x, pre_y) = (0, 0, 0)
for _ in range(N):
	(t, x, y) = list(map(int, input().split()))
	tmp = t - pre_t - abs(x - pre_x) - abs(y - pre_y)
	if tmp < 0 or tmp % 2 == 1:
		res = False
		break
	pre_t = t
	pre_x = x
	pre_y = y
print('Yes' if res else 'No')


N = int(input())
T = [list(map(int, input().split())) for i in range(N)]
for i in range(N):
	t = T[i][0]
	j = T[i][1] + T[i][2]
	if t < j or (t + j) % 2:
		print('No')
		exit()
print('Yes')


(t, x, y) = (0, 0, 0)
N = int(input())
r = 'Yes'
for i in range(0, N):
	(t2, x2, y2) = map(int, input().split())
	d = abs(x2 - x) + abs(y2 - y)
	if not (t2 - t >= d and d % 2 == (t2 - t) % 2):
		r = 'No'
		break
print(r)


n = int(input())
(tt, xx, yy) = (0, 0, 0)
ans = 0
for i in range(n):
	(t, x, y) = map(int, input().split())
	if (x - xx + y - yy) % 2 != (t - tt) % 2:
		ans = 1
	if x - xx + y - yy > t - tt:
		ans = 1
	(tt, xx, yy) = (t, x, y)
print('YNeos'[ans::2])


s = p = q = 0
for i in range(int(input())):
	(t, x, y) = map(int, input().split())
	l = abs(x - p) + abs(y - q)
	if (l - t - s) % 2 or l > t - s:
		print('No')
		break
	(s, p, q) = (t, x, y)
else:
	print('Yes')


n = int(input())
time_space = [(int(x) for x in input().split()) for i in range(n)]
pos = [0, 0]
for (t, x, y) in time_space:
	if x + y > t or (x + y + t) % 2:
		print('No')
		exit()
print('Yes')


n = int(input())
(pt, px, py) = (0, 0, 0)
for _ in range(n):
	(ct, cx, cy) = map(int, input().split())
	t = ct - pt
	d = abs(cx - px) + abs(cy - py)
	if t < d or t % 2 != d % 2:
		print('No')
		break
	(pt, px, py) = (ct, cx, cy)
else:
	print('Yes')


n = int(input())
cnt = 0
(t, x, y) = (0, 0, 0)
for i in range(n):
	(nt, nx, ny) = map(int, input().split())
	if abs(nx - x) + abs(ny - y) <= nt - t and t % 2 == (x + y) % 2:
		cnt += 1
	(t, x, y) = (nt, nx, ny)
print('Yes' if cnt == n else 'No')


n = int(input())
bt = 0
bx = 0
by = 0
for _ in range(n):
	(t, x, y) = map(int, input().split())
	dt = abs(x - bx) + abs(y - by)
	if dt > t - bt or dt % 2 != (t - bt) % 2:
		print('No')
		break
	bt = t
	bx = x
	by = y
else:
	print('Yes')


N = int(input())
T = []
XY = []

def f(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
(cx, cy) = (0, 0)
ct = 0
for _ in range(N):
	(t, x, y) = list(map(int, input().split()))
	d = f(cx, cy, x, y)
	if d > t - ct:
		print('No')
		return
	if (t - ct - d) % 2 != 0:
		print('No')
		return
	(cx, cy) = (x, y)
	ct = t
print('Yes')


N = int(input())
locx = 0
locy = 0
time = 0
for i in range(N):
	(t, x, y) = map(int, input().split())
	time = t - time
	dis = abs(locx - x) + abs(locy - y)
	if time - dis < 0:
		print('No')
		return
	if (time - dis) % 2 == 1:
		print('No')
		return
	time = t
	locx = x
	locy = y
else:
	print('Yes')


n = int(input())
arr = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
	(t1, x1, y1) = arr[i]
	(t2, x2, y2) = arr[i + 1]
	if abs(x1 - x2) + abs(y1 - y2) > t2 - t1:
		print('No')
		return
	if (abs(x1 - x2) + abs(y1 - y2)) % 2 != (t2 - t1) % 2:
		print('No')
		return
print('Yes')


N = int(input())
x = y = 0
for _ in range(N):
	(t, _x, _y) = map(int, input().split())
	dist = abs(_y - y) + abs(_x - x)
	if dist > t or (t - dist) % 2 == 1:
		print('No')
		quit()
print('Yes')


n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
	(t, x, y) = txy[i]
	if x + y > t or (t - x - y) % 2:
		print('No')
		exit()
print('Yes')


n = int(input())
for i in range(n):
	(t, abs_x, abs_y) = map(int, input().split())
	if abs_x + abs_y > t or (abs_x + abs_y) % 2 != t % 2:
		print('No')
		exit()
print('Yes')


import sys
input()
for e in sys.stdin:
	(t, x, y) = map(int, e.split())
	d = t - (x + y)
	if d < 0 or d % 2 == 1:
		print('No')
		exit()
print('Yes')


import math
n = int(input())
P = [0, 0]
t0 = 0
for _ in range(n):
	(t, x, y) = list(map(int, input().split()))
	dt = t - t0
	dis = abs(x - P[0]) + abs(y - P[1])
	if dis > dt:
		print('No')
		return
	elif (dt - dis) % 2 == 1:
		print('No')
		return
	t0 = t
	P = [x, y]
print('Yes')


import sys
N = int(input())
for _ in range(N):
	(t, x, y) = map(int, input().split())
	if (t >= x + y) & ((t - (x + y)) % 2 == 0):
		continue
	print('No')
	sys.exit()
print('Yes')


n = int(input())
n_list = [[0, 0, 0]]
for i in range(n):
	n_list.append(list(map(int, input().split())))
for t in range(n):
	dt = n_list[t + 1][0] - n_list[t][0]
	dist = abs(n_list[t + 1][1] - n_list[t][1]) + abs(n_list[t + 1][2] - n_list[t][2])
	if dist > dt:
		can = 'No'
		break
	xy = n_list
	if dist % 2 != dt % 2:
		can = 'No'
		break
	can = 'Yes'
print(can)


n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
x = y = t = 0
for i in range(n):
	(dx, dy, dt) = (l[i][1], l[i][2], l[i][0])
	dist = abs(dx - x + (dy - y))
	if abs(dt - t) < dist or (dt - t - dist) % 2:
		print('No')
		return
	(x, y, t) = (dx, dy, dt)
print('Yes')


n = int(input())

def func(start, goal, t):
	distance = abs(start[0] - goal[0]) + abs(start[1] - goal[1])
	if distance <= t and (t - distance) % 2 == 0:
		return True
	return False
now = 0
can = 1
start = [0, 0]
for i in range(n):
	(t, x, y) = [int(i) for i in input().split()]
	goal = [x, y]
	if not func(start, goal, t - now):
		can = 0
		break
	else:
		start = goal
		now = t
if can == 1:
	print('Yes')
else:
	print('No')


N = int(input())
tm_pos = [list(map(int, input().split())) for i in range(N)]
for i in tm_pos:
	if i[0] < i[1] + i[2] or i[0] % 2 != (i[1] + i[2]) % 2:
		print('No')
		exit()
print('Yes')


n = int(input())
y = 0
x = 1
for i in range(n):
	a = list(map(int, input().split()))
	if a[1] + a[2] > a[0]:
		x = 0
	elif (a[1] + a[2]) % 2 != a[0] % 2:
		x = 0
	else:
		y += 1
if x == 0:
	print('No')
elif x != 0 and y == n:
	print('Yes')


N = int(input())
f = True
for i in range(N):
	(t, x, y) = map(int, input().split())
	time_left = t - (x + y)
	if time_left < 0 or time_left % 2 != 0:
		f = False
		break
print('Yes' if f else 'No')


import sys
ans = 'Yes'
input()
for e in sys.stdin:
	(t, x, y) = map(int, e.split())
	t = t - x - y
	if t < 0 or t % 2 == 1:
		ans = 'No'
		break
print(ans)


N = int(input())
prev = (0, 0, 0)
flag = True
for i in range(N):
	(t, x, y) = map(int, input().split())
	if t % 2 != (x + y) % 2:
		flag = False
	if abs(x + y - prev[1] - prev[2]) > t - prev[0]:
		flag = False
	prev = (t, x, y)
if flag:
	print('Yes')
else:
	print('No')


n = int(input())
x = 0
y = 0
t = 0
for i in range(n):
	(T, X, Y) = map(int, input().split())
	if (abs(X - x) + abs(Y - y)) % 2 != (T - t) % 2 or abs(X - x) + abs(Y - y) > T - t:
		print('No')
		exit()
	t = T
	x = X
	y = Y
print('Yes')


n = int(input())
s = v = w = 0
for _ in range(n):
	(t, x, y) = map(int, input().split())
	(dt, dx, dy) = (t - s, x - v, y - w)
	if (dt + dx + dy) % 2 > 0 or dt < abs(dx) + abs(dy):
		print('No')
		break
	(s, v, w) = (t, x, y)
else:
	print('Yes')


n = int(input())
s = 0
a = 0
b = 0
for i in range(n):
	(t, x, y) = map(int, input().split())
	if abs(x - a) + abs(y - b) > t - s or (t - s - abs(x - a) - abs(y - b)) % 2 != 0:
		print('No')
		exit()
	s = t
	a = x
	b = y
print('Yes')


n = int(input())
flag = 1
(ct, cx, cy) = (0, 0, 0)
for i in range(n):
	(t, x, y) = map(int, input().split())
	if t - ct < abs(x - cx) + abs(y - cy) or (t + x + y) % 2 != 0:
		flag = 0
print('Yes' if flag == 1 else 'No')


N = int(input())
count = 0
for i in range(N):
	(T, X, Y) = map(int, input().split())
	if T % 2 == (X + Y) % 2 and T >= X + Y:
		count += 1
if count == N:
	print('Yes')
else:
	print('No')


N = int(input())
x = 0
y = 0
for _ in range(N):
	(ti, xi, yi) = map(int, input().split())
	if ti - (abs(x - xi) + abs(y - yi)) < 0 or (ti - (abs(x - xi) + abs(y - yi))) % 2 == 1:
		print('No')
		exit()
print('Yes')


n = int(input())
flag = 0
for _ in range(n):
	(t, x, y) = map(int, input().split())
	if t % 2 == (x + y) % 2 and t >= x + y:
		continue
	else:
		flag = 1
print('Yes') if not flag else print('No')


N = int(input())
P = [(0, 0, 0)] + [tuple((int(x) for x in input().split())) for _ in range(N)]

def travelable(p, q):
	time = q[0] - p[0]
	dist = abs(q[1] - p[1]) + abs(q[2] - p[2])
	if dist <= time and time % 2 == dist % 2:
		return True
	else:
		return False
print('Yes' if all((travelable(p, q) for (p, q) in zip(P[:N], P[1:]))) else 'No')


n = int(input())
(x, y) = (0, 0)
tf = 0
for i in range(n):
	(t, a, b) = map(int, input().split())
	if a + b > t or (a + b + t) % 2 == 1:
		print('No')
		exit()
print('Yes')


import sys
input = sys.stdin.readline

def main():
	ans = 'Yes'
	n = int(input())
	now = [0, 0]
	pt = 0
	for i in range(n):
		(t, x, y) = map(int, input().split())
		d = abs(x - now[0] + (y - now[1]))
		if d > abs(t - pt) or (t - pt) % 2 != d % 2:
			ans = 'No'
			break
		now = [x, y]
		pt = t
	print(ans)

def __starting_point():
	main()
__starting_point()


N = int(input())
(t0, x0, y0) = (0, 0, 0)
for i in range(N):
	(t, x, y) = list(map(int, input().strip().split(' ')))
	l = x + y - x0 - y0
	if (t0 - t) % 2 ^ l % 2:
		print('No')
		exit()
	if t - t0 < l:
		print('No')
		exit()
	(t0, x0, y0) = (t, x, y)
print('Yes')


n = int(input())
t0 = 0
x0 = 0
y0 = 0
ok = True
for i in range(n):
	(t1, x1, y1) = map(int, input().split())
	c = t1 - t0 - x1 + x0 - y1 + y0
	if c < 0 or c % 2 == 1:
		ok = False
		break
print('Yes' if ok else 'No')


N = int(input())
(x, y, e) = (0, 0, 0)
f = True
for _ in range(N):
	(a, b, c) = map(int, input().split())
	d = a - e - (b - x) - (c - y)
	x = b
	y = c
	e = a
	if d % 2 or d < 0:
		f = False
if f:
	print('Yes')
else:
	print('No')


N = int(input())
(t, x, y) = (0, 0, 0)
for i in range(N):
	(a, b, c) = (t, x, y)
	(t, x, y) = map(int, input().split())
	d = abs(x - b) + abs(y - c)
	e = t - a
	if d % 2 != e % 2 or d > e:
		print('No')
		return
print('Yes')


n = int(input())
u = 0
p = 0
q = 0
for _ in range(n):
	(t, x, y) = map(int, input().split())
	if abs(p - x) + abs(q - y) <= t - u and (t - u - abs(p - x) - abs(q - y)) % 2 == 0:
		u = t
		p = x
		q = y
	else:
		print('No')
		break
else:
	print('Yes')


n = int(input())
(ti, xi, yi) = (0, 0, 0)
for i in range(n):
	(ti1, xi1, yi1) = list(map(int, input().split()))
	if abs(xi1 - xi) + abs(yi1 - yi) <= ti1 - ti and (abs(xi1 - xi) + abs(yi1 - yi)) % 2 == (ti1 - ti) % 2:
		xi = xi1
		yi = yi1
		ti = ti1
		continue
	else:
		print('No')
		return
print('Yes')


n = int(input())
ans = 'Yes'
dt = 0
cur = 0
cur_t = 0
dist = 0
for i in range(n):
	(t, x, y) = map(int, input().split())
	dist = abs(cur - (x + y))
	cur = x + y
	dt = t - cur_t
	cur_t = t
	if dist > dt or dt % 2 != dist % 2:
		ans = 'No'
		break
print(ans)


n = int(input())
judge = 'Yes'
past_t = past_x = past_y = 0
for i in range(n):
	(t, x, y) = map(int, input().split())
	if t - past_t < x + y or (t - past_t - (x + y)) % 2 != 0:
		judge = 'No'
print(judge)


n = int(input())
l = [list(map(int, input().split())) for l in range(n)]
for i in l:
	if i[1] + i[2] > i[0] or i[0] % 2 != (i[1] + i[2]) % 2:
		print('No')
		exit()
print('Yes')


n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]
(px, py) = (0, 0)
pt = 0
for (t, x, y) in txy:
	if not (x + y <= t and (x + y) % 2 == t % 2 and (abs(x - px) + abs(y - py) <= t - pt)):
		print('No')
		return
	(px, py) = (x, y)
	pt = t
print('Yes')


n = int(input())
xx = 0
yy = 0
tt = 0
for i in range(n):
	(t, x, y) = map(int, input().split())
	d = abs(xx - x) + abs(yy - y)
	if t - tt < d or (t - tt - d) % 2 == 1:
		print('No')
		return
	xx = x
	yy = y
	tt = t
print('Yes')


N = int(input())
(t0, x0, y0) = (0, 0, 0)
for i in range(N):
	(t, x, y) = list(map(int, input().split()))
	kyori = abs(x - x0) + abs(y - y0)
	time = t - t0
	if abs(kyori - time) % 2 == 0 and time - kyori >= 0:
		(t0, x0, y0) = (t, x, y)
	else:
		print('No')
		return
print('Yes')


N = int(input())
T = [0] * (N + 1)
S = [0] * (N + 1)
f = 0
for i in range(1, N + 1):
	(t, x, y) = map(int, input().split())
	T[i] = t
	S[i] = [x, y]
T[0] = 0
S[0] = [0, 0]
for i in range(1, N + 1):
	if T[i] - T[i - 1] < abs(S[i][0] - S[i - 1][0]) + abs(S[i][1] - S[i - 1][1]):
		f = 1
	if (T[i] - T[i - 1]) % 2 != (abs(S[i][0] - S[i - 1][0]) + abs(S[i][1] - S[i - 1][1])) % 2:
		f = 1
print('Yes' if f == 0 else 'No')


N = int(input())
t_x_y = [list(map(int, input().split())) for _ in range(N)]
t_x_y.insert(0, [0, 0, 0])
ans = 'Yes'
for i in range(N):
	dt = t_x_y[i + 1][0] - t_x_y[i][0]
	dist = abs(t_x_y[i + 1][1] - t_x_y[i][1]) + abs(t_x_y[i + 1][2] - t_x_y[i][2])
	if dt < dist:
		ans = 'No'
		break
	elif (dt - dist) % 2 != 0:
		ans = 'No'
		break
print(ans)


n = int(input())
location = list(map(str, [input() for i in range(n)]))
fail = 0
for j in range(n):
	if j == 0:
		a = [0, 0, 0]
	else:
		a = list(map(int, location[j - 1].split()))
	b = list(map(int, location[j].split()))
	x = abs(a[1] - b[1])
	y = abs(a[2] - b[2])
	t = b[0] - a[0]
	if x + y <= t:
		if (x + y) % 2 == t % 2:
			pass
		else:
			fail += 1
	else:
		fail += 1
if fail == 0:
	print('Yes')
else:
	print('No')


n = int(input())
for i in range(n):
	(t, x, y) = map(int, input().split())
	if x + y > t or (x + y + t) % 2:
		print('No')
		quit()
print('Yes')


n = int(input())
t = 0
x = 0
y = 0
for i in range(n):
	(t_, x_, y_) = map(int, input().split())
	t = abs(t_ - t)
	x = abs(x_ - x)
	y = abs(y_ - y)
	if x + y > t:
		print('No')
		return
	if t_ % 2 != (x_ + y_) % 2:
		print('No')
		return
print('Yes')


n = int(input())
t = [list(map(int, input().split())) for i in range(n)]
flag = 'Yes'
for i in range(n):
	if t[i][1] + t[i][2] > t[i][0] or (t[i][1] + t[i][2]) % 2 != t[i][0] % 2:
		flag = 'No'
print(flag)


N = int(input())
yes = True
for _ in range(N):
	(t, x, y) = map(int, input().split())
	margin = t - (x + y)
	if not (margin >= 0 and margin % 2 == 0):
		yes = False
if yes:
	print('Yes')
else:
	print('No')


N = int(input())
P = [(0, 0, 0)]
for i in range(N):
	(t, x, y) = map(int, input().split())
	P.append((t, x, y))
T = [0] * N
dist = [0] * N
for i in range(N):
	T[i] = P[i + 1][0] - P[i][0]
	dist[i] = abs(P[i + 1][1] - P[i][1]) + abs(P[i + 1][2] - P[i][2])
ans = 1
for i in range(N):
	if dist[i] > T[i]:
		ans = 0
	else:
		m = T[i] - dist[i]
		if m % 2 == 0:
			pass
		else:
			ans = 0
	if ans == 0:
		break
print('Yes' if ans == 1 else 'No')


n = int(input())
(x, y, t) = (0, 0, 0)
for i in range(n):
	(mt, mx, my) = map(int, input().split())
	ft = mt - t
	fx = abs(x - mx)
	fy = abs(y - my)
	if fx + fy > ft:
		print('No')
		return
	elif (ft - (fx + fy)) % 2 == 0:
		pass
	else:
		print('No')
		return
	(x, y, t) = (mx, my, mt)
print('Yes')


N = int(input())
(pt, px, py) = (0, 0, 0)
can = True
for i in range(N):
	(t, x, y) = map(int, input().split())
	(T, X, Y) = (t - pt, abs(x - px), abs(y - py))
	if T < X + Y or T % 2 != (X + Y) % 2:
		can = False
	(pt, px, py) = (t, x, y)
print('Yes' if can else 'No')


n = int(input())
for _ in range(n):
	(t, x, y) = list(map(int, input().split()))
	if x + y > t or (t + x + y) % 2 != 0:
		print('No')
		break
else:
	print('Yes')


n = int(input())
(x, y) = (0, 0)
for _ in range(n):
	(t, xnew, ynew) = map(int, input().split())
	dist = abs(x - xnew) + abs(y - ynew)
	if dist > t or (dist - t) % 2 == 1:
		print('No')
		exit()
print('Yes')


n = int(input())
bx = by = bt = 0
ans = 'Yes'
for i in range(n):
	(t, x, y) = map(int, input().split())
	if t % 2 != (x + y) % 2:
		ans = 'No'
	if abs(bx - x) + abs(by - y) > abs(bt - t):
		ans = 'No'
	bx = x
	by = y
	bt = t
print(ans)


import sys
n = int(input())
for i in range(n):
	(t, x, y) = map(int, input().split())
	if not (x + y <= t and (x + y) % 2 == t % 2):
		print('No')
		sys.exit()
print('Yes')


n = int(input())
(x, y) = (0, 0)
t = 0
for i in range(n):
	(ti, xi, yi) = list(map(int, input().split()))
	l = abs(xi - x + yi - y)
	if l <= ti - t and l % 2 == (ti - t) % 2:
		(x, y) = (xi, yi)
		t = ti
	else:
		print('No')
		break
else:
	print('Yes')


n = int(input())
f = True
for i in range(n):
	(t, x, y) = map(int, input().split())
	if t < x + y or t % 2 != (x + y) % 2:
		f = False
		break
if f == True:
	print('Yes')
else:
	print('No')


n = int(input())
T = [0]
X = [0]
Y = [0]
judge = 'Yes'
for i in range(n):
	(t, x, y) = map(int, input().split())
	T.append(t)
	X.append(x)
	Y.append(y)
for i in range(1, n + 1):
	delt_t = T[i] - T[i - 1]
	t_parity = delt_t % 2
	d = abs(X[i] - X[i - 1]) + abs(Y[i] - Y[i - 1])
	d_parity = d % 2
	if delt_t >= d and t_parity == d_parity:
		continue
	else:
		judge = 'No'
		break
print(judge)


n = int(input())
flag = True
for _ in range(n):
	(t, x, y) = map(int, input().split())
	if t < x + y or (x + y + t) % 2 == 1:
		flag = False
if flag:
	print('Yes')
else:
	print('No')


n = int(input())
ans = True
for i in range(n):
	(t, x, y) = map(int, input().split())
	if (x + y) % 2 != t % 2:
		ans = False
	if x + y > t:
		ans = False
if ans:
	print('Yes')
else:
	print('No')


n = int(input())
z = 0
for i in range(n):
	(t, x, y) = map(int, input().split())
	if x + y <= t and (x + y) % 2 == t % 2:
		z += 1
if z == n:
	print('Yes')
else:
	print('No')


N = int(input())
t = 0
xy = [0, 0]
ans = 'Yes'
for i in range(N):
	(ti, xi, yi) = map(int, input().split())
	dt = ti - t
	dx = abs(xi - xy[0])
	dy = abs(yi - xy[1])
	if dt < dx + dy:
		ans = 'No'
	elif dt % 2 != (dx + dy) % 2:
		ans = 'No'
	t = ti
	xy = [xi, yi]
print(ans)


n_num = int(input())
plan_list = [[0, (0, 0)]]

def movable(p1, p2):
	time = p2[0] - p1[0]
	distance = 0
	distance += abs(p1[1][0] - p2[1][0])
	distance += abs(p1[1][1] - p2[1][1])
	if distance > time:
		return 0
	elif (time - distance) % 2 != 0:
		return 0
	else:
		return 1
for _ in range(n_num):
	line = [int(i) for i in input().split()]
	plan_list.append([line[0], (line[1], line[2])])
vector = (0, 0)
flag = 0
for n in range(1, n_num + 1):
	if movable(plan_list[n - 1], plan_list[n]) == 0:
		flag = 1
if flag == 1:
	print('No')
else:
	print('Yes')


n = int(input())
txylist = [[0, 0, 0]]
for i in range(n):
	txy = list(map(int, input().split(' ')))
	txylist += [txy]
for i in range(n):
	p = False
	(t0, x0, y0) = txylist[i]
	(t1, x1, y1) = txylist[i + 1]
	(t, x, y) = (t1 - t0, x1 - x0, y1 - y0)
	tt = abs(x) + abs(y)
	legs = t - tt
	if legs >= 0 and legs % 2 == 0:
		p = True
	else:
		print('No')
		break
if p == True:
	print('Yes')


n = int(input())
ans = 'Yes'
for _ in range(n):
	(t, x, y) = map(int, input().split())
	if t < x + y or (t + x + y) % 2 == 1:
		ans = 'No'
		break
print(ans)


N = int(input())
for i in range(N):
	(t, x, y) = map(int, input().split())
	if x + y <= t and t % 2 == (x + y) % 2:
		pass
	else:
		print('No')
		exit()
print('Yes')


N = int(input())
TXY = [map(int, input().split()) for _ in range(N)]
ans = 'Yes'
for (t, x, y) in TXY:
	if (x + y) % 2 != t % 2:
		ans = 'No'
		break
	if x + y > t:
		ans = 'No'
		break
print(ans)


n = int(input())
x = 0
y = 0
t = 0
fl = True
for i in range(n):
	(nt, nx, ny) = map(int, input().split())
	dist = abs(x - nx) + abs(y - ny)
	if (nt - t) % 2 != dist % 2 or nt - t < dist:
		print('No')
		break
	(x, y) = (nx, ny)
	t = nt
else:
	print('Yes')


n = int(input())
(prev_t, prev_x, prev_y) = (0, 0, 0)
for _ in range(n):
	(t, x, y) = map(int, input().split())
	if abs(x - prev_x) + abs(y - prev_y) <= t - prev_t and (abs(x - prev_x) + abs(y - prev_y)) % 2 == (t - prev_t) % 2:
		(prev_t, prev_x, prev_y) = (t, x, y)
		continue
	else:
		print('No')
		break
else:
	print('Yes')


import sys
sys.setrecursionlimit(10 ** 6)
n = int(input())
(t, x, y) = (0, 0, 0)
for i in range(n):
	(t_new, x_new, y_new) = list(map(int, input().split()))
	time = t_new - t
	dis = abs(x_new - x) + abs(y_new - y)
	if time < dis:
		print('No')
		return
	if time % 2 != dis % 2:
		print('No')
		return
	(t, x, y) = (t_new, x_new, y_new)
print('Yes')


from collections import deque
N = int(input())
txy = [map(int, input().split()) for _ in range(N)]
(t, x, y) = [list(i) for i in zip(*txy)]
t = deque(t)
x = deque(x)
y = deque(y)
t.appendleft(0)
x.appendleft(0)
y.appendleft(0)
for i in range(N):
	direct = t[i + 1] - t[i] - abs(x[i + 1] - x[i]) - abs(y[i + 1] - y[i])
	if direct < 0 or direct % 2 != 0:
		print('No')
		return
print('Yes')


N = int(input())
P = [[0, 0, 0]]
for i in range(N):
	(t, x, y) = list(map(int, input().split()))
	P.append([t, x, y])
judge = True
for i in range(1, N + 1):
	dt = P[i][0] - P[i - 1][0]
	dist = abs(P[i][1] - P[i - 1][1]) + abs(P[i][2] - P[i - 1][2])
	if dt % 2 == 0 and dist % 2 == 0 and (dist <= dt) or (dt % 2 == 1 and dist % 2 == 1 and (dist <= dt)):
		judge = True
	else:
		judge = False
if judge:
	print('Yes')
else:
	print('No')


import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10 ** 6)

def zz():
	return list(map(int, sys.stdin.readline().split()))

def z():
	return int(sys.stdin.readline())

def S():
	return sys.stdin.readline()[:-1]

def C(line):
	return [sys.stdin.readline() for _ in range(line)]
N = z()
(T, X, Y) = ([], [], [])
(pos_x, pos_y, now_t) = (0, 0, 0)
for i in range(N):
	(t, x, y) = zz()
	T.append(t)
	X.append(x)
	Y.append(y)
ok = 1
for (t, x, y) in zip(T, X, Y):
	if abs(x - pos_x) + abs(y - pos_y) > t - now_t:
		ok = 0
		break
	if (abs(x - pos_x) + abs(y - pos_y)) % 2 != (t - now_t) % 2:
		ok = 0
		break
	(pos_x, pos_y, now_t) = (x, y, t)
if ok == 1:
	print('Yes')
else:
	print('No')


n = int(input())
(p, q) = (0, 0)
ans = 'Yes'
for i in range(n):
	(t, x, y) = map(int, input().split())
	if not (x - p + y - q <= t and (x - p + y - q - t) % 2 == 0):
		ans = 'No'
		break
print(ans)


N = int(input())
T = [0, 0, 0]
ans = 'Yes'
for _ in range(N):
	t = list(map(int, input().split()))
	k = abs(t[1] + t[2] - (T[1] + T[2]))
	n = t[0] - T[0]
	if n % 2 == 0:
		if k > n or k % 2 != 0:
			ans = 'No'
	elif k > n or k % 2 == 0:
		ans = 'No'
	T = t
print(ans)


N = int(input())
txy = [[0, 0, 0]]
for i in range(N):
	txy.append(list(map(int, input().split())))
for i in range(N):
	dt = txy[i + 1][0] - txy[i][0]
	dx = txy[i + 1][1] - txy[i][1]
	dy = txy[i + 1][2] - txy[i][2]
	if dt < abs(dx + dy):
		print('No')
		break
	elif (dt - (dx + dy)) % 2 != 0:
		print('No')
		break
else:
	print('Yes')


from collections import namedtuple
plan = namedtuple('plan', ['time', 'x', 'y'])

def main():
	with open(0) as f:
		N = int(f.readline())
		plans = []
		for _ in range(N):
			(t, x, y) = map(int, f.readline().split())
			plans.append(plan(t, x, y))
	current = plan(0, 0, 0)
	for p in plans:
		t = p.time - current.time
		way = abs(p.x - current.x) + abs(p.y - current.y)
		if t < way:
			print('No')
			return None
		if t - way & 1:
			print('No')
			return None
		current = p
	else:
		print('Yes')
main()


n = int(input())
(pt, px, py) = (0, 0, 0)
f = 0
for i in range(n):
	(t, x, y) = map(int, input().split())
	gt = t - pt
	(gx, gy) = (abs(x - px), abs(y - py))
	gt -= gx + gy
	if gt < 0 or gt % 2 == 1:
		f = 1
	(pt, px, py) = (t, x, y)
if f:
	print('No')
else:
	print('Yes')


N = int(input())
ans = True
for i in range(N):
	(a, b, c) = map(int, input().split())
	n = a - abs(b) - abs(c)
	if n < 0 or n % 2 == 1:
		ans = False
if ans == True:
	print('Yes')
else:
	print('No')


N = int(input())
a = 0
for i in range(N):
	a = list(map(int, input().split()))
	if a[0] < sum(a) - a[0]:
		print('No')
		exit()
	if (sum(a) - a[0] - a[0]) % 2 != 0:
		print('No')
		exit()
print('Yes')


n = int(input())
a = [[int(i) for i in input().split()] for i in range(n)]
for i in a:
	if i[0] % 2 != (i[1] + i[2]) % 2 or i[0] < i[1] + i[2]:
		print('No')
		exit()
print('Yes')


n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
(t, x, y) = (0, 0, 0)
for (T, X, Y) in a:
	if T - t < X - x + Y - y or (T + X + Y) % 2 == 1:
		print('No')
		exit()
	(t, x, y) = (T, X, Y)
print('Yes')


N = int(input())
for __ in range(N):
	(t, x, y) = map(int, input().split())
	if x + y > t or (x + y + t) % 2 == 1:
		print('No')
		exit(0)
print('Yes')


n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
ans = True
for i in l:
	(t, x, y) = (i[0], i[1], i[2])
	if x + y > t or (x + y) % 2 != t % 2:
		ans = False
print('Yes') if ans else print('No')


n = int(input())
r = 'Yes'
for i in range(n):
	(t, a, b) = map(int, input().split())
	s = abs(a) + abs(b)
	if s > t or (t - s) % 2 != 0:
		r = 'No'
print(r)


(nt, nx, ny) = (0, 0, 0)
ans = 'Yes'
for _ in range(int(input())):
	(t, x, y) = map(int, input().split())
	d = abs(x - nx) + abs(y - ny)
	if t - nt < d:
		ans = 'No'
		break
	elif (t - nt - d) % 2 != 0:
		ans = 'No'
		break
print(ans)


n = int(input())
c = 0
for i in range(n):
	(ti, xi, yi) = map(int, input().split())
	if (xi + yi) % 2 == ti % 2 and ti >= xi + yi:
		c += 1
if n <= c <= n:
	print('Yes')
else:
	print('No')


n = int(input())
count = 0
for i in range(n):
	(t, x, y) = map(int, input().split())
	if t - x - y < 0 or (t - x - y) % 2 == 1:
		count += 1
if count == 0:
	print('Yes')
else:
	print('No')


(_, *p) = map(int, open(0).read().split())
print(('Yes', 'No')[sum((1 for (t, x, y) in zip(*[iter(p)] * 3) if t < x + y or t % 2 != (x + y) % 2)) > 0])


n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]
(pT, pX, pY) = (0, 0, 0)
for i in range(n):
	(cT, cX, cY) = d[i]
	(mvT, mvX, mvY) = (abs(cT - pT), abs(cX - pX), abs(cY - pY))
	dam = mvT - (mvX + mvY)
	if dam % 2 == 1 or dam < 0:
		print('No')
		return
	(pT, pX, pY) = d[i]
print('Yes')


cnt = int(input())
(t_s, x_s, y_s) = (0, 0, 0)
for _ in range(cnt):
	(t, x, y) = map(int, input().split())
	(d_t, d_x, d_y) = (t - t_s, x - x_s, y - y_s)
	z = abs(d_x + d_y)
	if z > d_t or (d_t - z) % 2 == 1:
		print('No')
		break
	(t_s, x_s, y_s) = (t, x, y)
else:
	print('Yes')


def main():
	import sys
	pin = sys.stdin.readline
	pout = sys.stdout.write
	perr = sys.stderr.write
	N = int(pin())
	time = 0
	nx = 0
	ny = 0
	for i in range(N):
		(t, x, y) = list(map(int, pin().split()))
		d = abs(nx - x) + abs(ny - y)
		s = t - time
		if d <= s and s % 2 == d % 2:
			time = t
			nx = x
			ny = y
		else:
			print('No')
			return
	print('Yes')
	return
main()


n = int(input())
k = 0
for i in range(n):
	(t, x, y) = map(int, input().split())
	if t < x + y or t % 2 != (x + y) % 2:
		print('No')
		break
	if i == n - 1:
		print('Yes')


(t, x, y, f) = (0, 0, 0, 1)
for i in [0] * int(input()):
	(a, b, c) = map(int, input().split())
	d = abs(x - b) + abs(y - c)
	e = abs(t - a)
	if e < d or e % 2 != d % 2:
		f = 0
	else:
		(t, x, y) = (a, b, c)
print(['No', 'Yes'][f])


N = int(input())
txy = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N):
	(t, x, y) = (txy[i][0], txy[i][1], txy[i][2])
	if x + y <= t and t % 2 == (x + y) % 2:
		ans += 1
print('Yes' if ans == N else 'No')


n = int(input())
pos = [0, 0]
time = 0
for _ in range(n):
	(t, x, y) = list(map(int, input().split()))
	dist = abs(pos[0] - x) + abs(pos[1] - y)
	if t - time < dist:
		print('No')
		return
	rest = t - time
	if rest % 2 != dist % 2:
		print('No')
		return
	time = t
	pos = [x, y]
print('Yes')


n = int(input())
for i in range(n):
	(t, x, y) = map(int, input().split())
	if x + y <= t and (x + y + t) % 2 == 0:
		continue
	else:
		break
else:
	print('Yes')
	quit()
print('No')


N = int(input())
T = 0
X = 0
Y = 0
for i in range(N):
	(t, x, y) = list(map(int, input().split()))
	dt = t - T
	dx = abs(X - x)
	dy = abs(Y - y)
	dis = dx + dy
	if dt < dis:
		print('No')
		break
	if (dt - dis) % 2 == 1:
		print('No')
		break
	T = t
	X = x
	Y = y
else:
	print('Yes')


N = int(input())
ans = True
for _ in range(N):
	(t, x, y) = map(int, input().split())
	if t < x + y:
		ans = False
	if t % 2 != (x + y) % 2:
		ans = False
if ans:
	print('Yes')
else:
	print('No')


n = int(input())
a = [[0, 0, 0]]
for i in range(n):
	a.append(list(map(int, input().split(' '))))
for i in range(n):
	check = a[i + 1][0] - a[i][0] - (abs(a[i + 1][1] - a[i][1]) + abs(a[i + 1][2] - a[i][2]))
	if check >= 0 and check % 2 == 0:
		continue
	else:
		print('No')
		break
else:
	print('Yes')


for _ in [0] * int(input()):
	(t, x, y) = map(int, input().split())
	if (t + x + y) % 2 + (t < x + y):
		print('No')
		exit()
print('Yes')


n = int(input())
tx = ty = tt = 0
for i in range(n):
	(t, x, y) = map(int, input().split())
	m = abs(x - tx) + abs(y - ty)
	if t < x + y or (t - tt) % 2 != m % 2:
		print('No')
		exit()
print('Yes')


N = int(input())
t = x = y = 0
for i in range(N):
	(t_, x_, y_) = map(int, input().split())
	k = t_ - t - (x_ - x + y_ - y)
	if k < 0 or k % 2 == 1:
		print('No')
		quit()
	t = t_
	x = x_
	y = y_
print('Yes')


n = int(input())
txy = [[int(i) for i in input().split()] for _ in range(n)]
ans = 'Yes'
for (t, x, y) in txy:
	if (x + y) % 2 != t % 2:
		ans = 'No'
		break
	if x + y > t:
		ans = 'No'
		break
print(ans)


N = int(input())
P = [list(map(int, input().split())) for i in range(N)]
pret = prex = prey = 0
f = 1
for i in range(N):
	t = P[i][0]
	x = P[i][1]
	y = P[i][2]
	td = t - pret
	xd = abs(x - prex)
	yd = abs(y - prey)
	diff = xd + yd
	if td < diff:
		f = 0
		break
	if (td - diff) % 2 == 0:
		pret = t
		prex = x
		prey = y
		continue
	else:
		f = 0
		break
if f == 1:
	print('Yes')
else:
	print('No')


n = int(input())
ta = 0
xa = 0
ya = 0
count = 0
for i in range(n):
	(t, x, y) = map(int, input().split())
	if x - xa + y - ya <= t - ta and (t - ta + x - xa + y - ya) % 2 == 0:
		ta = t
		xa = x
		ya = y
		count += 1
print('Yes' if count == n else 'No')


def main():
	N = int(input())
	ans = 'Yes'
	(t, x, y) = (0, 0, 0)
	for _ in range(N):
		(nt, nx, ny) = list(map(int, input().split()))
		d = abs(x - nx) + abs(y - ny)
		if d > nt - t or (nt - t - d) % 2 != 0:
			ans = 'No'
			break
		(t, x, y) = (nt, nx, ny)
	print(ans)

def __starting_point():
	main()
__starting_point()


n = int(input())
l = [(0, 0, 0)]
flag = 1
for i in range(n):
	l.append(list(map(int, input().split())))
for i in range(n):
	d = abs(l[i + 1][1] - l[i][1]) + abs(l[i + 1][2] - l[i][2])
	if l[i + 1][0] - l[i][0] >= d and (l[i + 1][0] - l[i][0] - d) % 2 == 0:
		continue
	else:
		flag = 0
if flag:
	print('Yes')
else:
	print('No')


import sys
from typing import NamedTuple, List

def fast_input():
	return sys.stdin.readline()[:-1]

class Position(NamedTuple):
	t: int
	x: int
	y: int

	def _calc_diff_move(self, position) -> int:
		diff_x = self.x - position.x
		diff_y = self.y - position.y
		return abs(diff_x) + abs(diff_y)

	def can_move_from(self, prev) -> bool:
		diff_t = self.t - prev.t
		diff_move = self._calc_diff_move(prev)
		if not diff_t % 2 == diff_move % 2:
			return False
		return diff_t >= diff_move

def result_format(b: bool) -> str:
	return 'Yes' if b else 'No'

def solve(positions: List[Position]) -> bool:
	positions = [Position(t=0, x=0, y=0)] + positions
	for p_ind in range(len(positions) - 1):
		p_curr = positions[p_ind]
		p_next = positions[p_ind + 1]
		if not p_next.can_move_from(p_curr):
			return False
	return True

def main():
	n = int(fast_input())
	positions = []
	for _ in range(n):
		(t, x, y) = list(map(int, fast_input().split()))
		positions.append(Position(t=t, x=x, y=y))
	result = solve(positions)
	print(result_format(result))
main()


N = int(input())
for i in range(N):
	(a, b, c) = map(int, input().split())
	if abs(b) + abs(c) > a or (a + b + c) % 2 == 1:
		print('No')
		exit()
print('Yes')


n = int(input())
rx = 0
ry = 0
rt = 0
ok = True
for _ in range(n):
	(t, x, y) = map(int, input().split())
	dist = abs(x - rx) + abs(y - ry)
	if dist <= abs(t - rt) and (abs(t - rt) - dist) % 2 == 0:
		rx = x
		ry = y
		rt = t
	else:
		ok = False
if ok:
	print('Yes')
else:
	print('No')


import sys
l = sys.stdin.readlines()
for i in l[1:]:
	(t, x, y) = map(int, i.split())
	if x + y > t or (x + y) % 2 != t % 2:
		print('No')
		break
else:
	print('Yes')


import math
from math import gcd, pi, sqrt
INF = float('inf')
import sys
sys.setrecursionlimit(10 ** 6)
import itertools
from collections import Counter, deque

def i_input():
	return int(input())

def i_map():
	return list(map(int, input().split()))

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

def s_map():
	return input().split()

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]

def main():
	n = i_input()
	xb = 0
	yb = 0
	tb = 0
	for i in range(n):
		(t, x, y) = i_map()
		walk = abs(x - xb) + abs(y - yb)
		if walk > t - tb:
			print('No')
			return
		if (t - tb - walk) % 2 != 0:
			print('No')
			return
		xb = x
		yb = y
		tb = t
	print('Yes')

def __starting_point():
	main()
__starting_point()


N = int(input())
txy = [map(int, input().split()) for _ in range(N)]
for (t, x, y) in txy:
	dist = x + y
	if t < dist or t % 2 != dist % 2:
		print('No')
		exit()
print('Yes')


n = int(input())
for _ in range(n):
	(dt, dx, dy) = list(map(int, input().split()))
	if dx + dy > dt:
		print('No')
		exit()
	if (dx + dy) % 2 != dt % 2:
		print('No')
		exit()
print('Yes')


N = int(input())
(t, x, y) = (0, 0, 0)
ans = 'Yes'
for n in range(N):
	(ti, xi, yi) = map(int, input().split())
	dist = abs(xi - x) + abs(yi - y)
	dt = ti - t
	if dist > dt or (dist - dt) % 2 != 0:
		ans = 'No'
		break
	(t, x, y) = (ti, xi, yi)
print(ans)


N = int(input())
TXY = [list(map(int, input().split(' '))) for i in range(N)]
(t, x, y) = (0, 0, 0)
for (i, j, k) in TXY:
	chk = i - t - (abs(x - j) + abs(y + k))
	if chk < 0 or chk % 2 != 0:
		print('No')
		exit()
print('Yes')


N = int(input())
Input = []
for i in range(N):
	Input.append(list(map(int, input().split())))
position = {'x': 0, 'y': 0}
preT = 0
for i in range(N):
	T = Input[i][0]
	x = Input[i][1]
	y = Input[i][2]
	move = abs(position['x'] - x) + abs(position['y'] - y)
	if move > T - preT or move % 2 != (T - preT) % 2:
		print('No')
		return
	preT = T
	position['x'] = x
	position['y'] = y
print('Yes')


N = int(input())
(x, y) = (0, 0)
time = 0
for i in range(N):
	(t, a, b) = map(int, input().split())
	if abs(x - a) + abs(y - b) > t - time or (abs(x - a) + abs(y - b) - t + time) % 2 == 1:
		print('No')
		exit()
	time = t
	x = a
	y = b
print('Yes')


Row = int(input())
List = []
for i in range(Row):
	List.append(list(map(int, input().split())))
x = 0
y = 0
T = 0
flag = True
for i in range(Row):
	reqT = abs(List[i][1] - x) + abs(List[i][2] - y)
	chck = List[i][0] - T - reqT
	if chck < 0 or chck % 2 == 1:
		flag = False
		break
	x = List[i][1]
	y = List[i][2]
	T = List[i][0]
if flag:
	print('Yes')
else:
	print('No')


N = int(input())
l = []
now = [0, 0, 0]
ans = 'Yes'
for _ in range(N):
	inp = list(map(int, input().split()))
	l.append(inp)
for i in range(N):
	shortest = abs(l[i][1] - now[1]) + abs(l[i][2] - now[2])
	if shortest > l[i][0] - now[0]:
		ans = 'No'
		break
	a = l[i][0] - now[0] - shortest
	if a % 2 != 0:
		ans = 'No'
		break
	else:
		now = l[i]
print(ans)


n = int(input())
txy = [list(map(int, input().split())) for i in range(n)]
(x, y) = (0, 0)
t = 0
for i in range(n):
	if abs(x + y - (txy[i][1] + txy[i][2])) % 2 == abs(t - txy[i][0]) % 2 and abs(t - txy[i][0]) >= abs(x + y - (txy[i][1] + txy[i][2])):
		(x, y) = (txy[i][1], txy[i][2])
	else:
		print('No')
		return
	t = txy[i][0]
print('Yes')


from sys import stdin, stdout

def solve():
	n = int(input())
	pos = []
	for _ in range(n):
		(t, x, y) = list(map(int, input().split()))
		pos.append((t, x, y))
	prev = (0, 0, 0)
	for p in pos:
		dt = p[0] - prev[0]
		move = abs(p[1] - prev[1]) + abs(p[2] - prev[2])
		if move > dt:
			print('No')
			return
		else:
			if (dt - move) % 2 == 1:
				print('No')
				return
			prev = p
	print('Yes')

def main():
	solve()

def __starting_point():
	main()
__starting_point()


for _ in range(int(input())):
	(t, x, y) = map(int, input().split())
	if (t + x + y) % 2 + (t < x + y):
		s = 1
		break
	s = 0
print('YNeos'[s::2])


n = int(input())
a = 0
b = 0
c = 0
for i in range(n):
	(d, e, f) = map(int, input().split())
	if abs(f - c) + abs(e - b) <= d - a and (d - a - (abs(f - c) + abs(e - b))) % 2 == 0:
		a = d
		b = e
		c = f
	else:
		print('No')
		exit()
print('Yes')


n = int(input())
s = 0
a = 0
b = 0
for i in range(n):
	(t, x, y) = map(int, input().split())
	if t - s - abs(x - a) - abs(y - b) >= 0 and (t - s - abs(x - a) - abs(y - b)) % 2 == 0:
		s = t
		a = x
		b = y
	else:
		print('No')
		return
print('Yes')


import sys
N = int(input())
t_param = 0
x_param = 0
y_param = 0
for i in range(N):
	(t, x, y) = map(int, input().split())
	if abs(x - x_param) + abs(y - y_param) > abs(t - t_param) or (x + y + t) % 2 != 0:
		print('No')
		return
	t_param = t
	x_param = x
	y_param = y
print('Yes')


N = int(input())
plan = []
Feasible = True
for i in range(N):
	(t, x, y) = map(int, input().split())
	plan.append([t, x, y])
(t0, x0, y0) = (0, 0, 0)
for (t1, x1, y1) in plan:
	dx = x1 - x0
	dy = y1 - y0
	dt = t1 - t0
	dist = abs(dx) + abs(dy)
	d = dt - dist
	if dt < dist:
		Feasible = False
	elif (dist + dt) % 2 != 0:
		Feasible = False
	(t0, x0, y0) = (t1, x1, y1)
print('Yes' if Feasible else 'No')


(n, *t) = map(int, open(0).read().split())
s = i = j = 0
for (t, x, y) in zip(t[::3], t[1::3], t[2::3]):
	d = abs(y - i) + abs(x - j)
	if t - s < d or d % 2 != (t - s) % 2:
		print('No')
		exit()
	(s, i, j) = (t, y, x)
print('Yes')


n = int(input())
x = [0, 0, 0]
ans = 'Yes'
for i in range(n):
	y = x
	x = list(map(int, input().split()))
	if x[0] - y[0] < abs(y[1] - x[1]) + abs(y[2] - x[2]) or (x[1] + x[2]) % 2 != x[0] % 2:
		ans = 'No'
		break
print(ans)


n = int(input())
root = []
(t, x, y) = (0, 0, 0)
for i in range(n):
	(ti, xi, yi) = map(int, input().split())
	if ti - t < xi - x + yi - y or (ti - t) % 2 != (xi - x + yi - y) % 2:
		print('No')
		break
	(t, x, y) = (ti, xi, yi)
else:
	print('Yes')


import numpy as np
N = int(input())
txy = [[0, 0, 0]]
for i in range(N):
	txy.append(list(map(int, input().split())))
out = 'Yes'
for i in range(1, N + 1):
	x = np.array(txy[i])
	y = np.array(txy[i - 1])
	mv = abs(x - y)
	dam = mv[0] - (mv[1] + mv[2])
	if dam % 2 == 1 or dam < 0:
		out = 'No'
print(out)


N = int(input())
success = True
(t0, x0, y0) = (0, 0, 0)
for i in range(N):
	(t1, x1, y1) = map(int, input().split())
	dist = abs(x1 - x0) + abs(y1 - y0)
	time = t1 - t0
	check1 = time == dist
	check2 = time > dist and (time - dist) % 2 == 0
	if not (check1 or check2):
		success = False
		break
	(t0, x0, y0) = (t1, x1, y1)
if success:
	print('Yes')
else:
	print('No')


def check(dest, start):
	ll = dest[1] - start[1] + dest[2] - start[2]
	if ll < 0:
		ll = -ll
	time = dest[0] - start[0]
	tmp = ll - time
	if tmp <= 0 and tmp % 2 == 0:
		return True
	else:
		return False
n = int(input())
start = [0, 0, 0]
for i in range(n):
	dest = list(map(int, input().split()))
	if check(dest, start):
		start = dest
	else:
		print('No')
		return
print('Yes')


N = int(input())
a = [list(map(int, input().split())) for i in range(N)]
for i in range(N):
	if i == 0:
		if (a[i][0] - a[i][1] - a[i][2]) % 2 != 0 or a[i][0] - a[i][1] - a[i][2] < 0:
			print('No')
			return
	elif (a[i][0] - a[i][1] - a[i][2]) % 2 != 0 or a[i][0] - a[i - 1][0] - (a[i - 1][1] + a[i - 1][2] - (a[i][1] + a[i][2])) < 0:
		print('No')
		return
print('Yes')


N = int(input())
count = 0
for i in range(N):
	(t, x, y) = map(int, input().split())
	if x + y <= t and t % 2 == (x + y) % 2:
		count += 1
print('Yes' if count == N else 'No')


n = int(input())
T = 0
X = 0
Y = 0
ans = 'Yes'
for i in range(n):
	(t, x, y) = map(int, input().split())
	s = t - T
	if s >= abs(X - x) + abs(Y - y) and (s - abs(X - x) + abs(Y - y)) % 2 == 0:
		(T, X, Y) = (t, x, y)
	else:
		ans = 'No'
		break
print(ans)


n = int(input())
s = [list(map(int, input().split())) for i in range(n)]
stand = [0, 0]
prev = 0
for (t, x, y) in s:
	diff = abs(x + y - sum(stand))
	walk = t - prev
	if diff <= walk and walk % 2 == diff % 2:
		stand = [x, y]
		prev = t
	else:
		print('No')
		break
else:
	print('Yes')


N = int(input())
L = []
for i in range(N):
	t = list(map(int, input().split()))
	L.append(t)
L.insert(0, [0, 0, 0])
for i in range(1, N + 1):
	time = abs(L[i - 1][0] - L[i][0])
	distance = abs(L[i - 1][1] - L[i][1]) + abs(L[i - 1][2] - L[i][2])
	if time < distance or time % 2 != distance % 2:
		print('No')
		return
print('Yes')


n = int(input())
(t, x, y) = (0, 0, 0)
for i in range(n):
	(nt, nx, ny) = map(int, input().split())
	if not (abs(nx - x) + abs(ny - y) <= nt - t and t % 2 == (x + y) % 2):
		print('No')
		exit()
	(t, x, y) = (nt, nx, ny)
print('Yes')


n = int(input())
x0 = 0
y0 = 0
t0 = 0
for i in range(n):
	(t, x, y) = map(int, input().split())
	d = abs(x - x0) + abs(y - y0)
	if d > t - t0:
		print('No')
		return
	elif (t - t0 - d) % 2 == 1:
		print('No')
		return
	else:
		x0 = x
		y0 = y
		t0 = t
print('Yes')


n = int(input())
px = py = pt = 0
for i in range(n):
	(t, x, y) = map(int, input().split())
	d = abs(x - px) + abs(y - py)
	nt = t - pt
	if nt < d or d % 2 != nt % 2:
		print('No')
		exit()
	px = x
	py = y
	pt = t
print('Yes')


def main():
	N = int(input())
	txy = [list(map(int, input().split())) for _ in range(N)]
	txy = [[0, 0, 0]] + txy
	for i in range(N):
		temp = txy[i + 1][0] - txy[i][0] - abs(txy[i + 1][1] - txy[i][1]) - abs(txy[i + 1][2] - txy[i][2])
		if not (temp % 2 == 0 and temp >= 0):
			print('No')
			return
	print('Yes')
main()