Polycarp has recently created a new level in this cool new game Berlio Maker 85 and uploaded it online. Now players from all over the world can try his level.

All levels in this game have two stats to them: the number of plays and the number of clears. So when a player attempts the level, the number of plays increases by $1$. If he manages to finish the level successfully then the number of clears increases by $1$ as well. Note that both of the statistics update at the same time (so if the player finishes the level successfully then the number of plays will increase at the same time as the number of clears).

Polycarp is very excited about his level, so he keeps peeking at the stats to know how hard his level turns out to be.

So he peeked at the stats $n$ times and wrote down $n$ pairs of integers — $(p_1, c_1), (p_2, c_2), \dots, (p_n, c_n)$, where $p_i$ is the number of plays at the $i$-th moment of time and $c_i$ is the number of clears at the same moment of time. The stats are given in chronological order (i.e. the order of given pairs is exactly the same as Polycarp has written down).

Between two consecutive moments of time Polycarp peeked at the stats many players (but possibly zero) could attempt the level.

Finally, Polycarp wonders if he hasn't messed up any records and all the pairs are correct. If there could exist such a sequence of plays (and clears, respectively) that the stats were exactly as Polycarp has written down, then he considers his records correct.

Help him to check the correctness of his records.

For your convenience you have to answer multiple independent test cases.


-----Input-----

The first line contains a single integer $T$ $(1 \le T \le 500)$ — the number of test cases.

The first line of each test case contains a single integer $n$ ($1 \le n \le 100$) — the number of moments of time Polycarp peeked at the stats.

Each of the next $n$ lines contains two integers $p_i$ and $c_i$ ($0 \le p_i, c_i \le 1000$) — the number of plays and the number of clears of the level at the $i$-th moment of time.

Note that the stats are given in chronological order.


-----Output-----

For each test case print a single line.

If there could exist such a sequence of plays (and clears, respectively) that the stats were exactly as Polycarp has written down, then print "YES".

Otherwise, print "NO".

You can print each letter in any case (upper or lower).


-----Example-----
Input
6
3
0 0
1 1
1 2
2
1 0
1000 3
4
10 1
15 2
10 2
15 2
1
765 432
2
4 4
4 3
5
0 0
1 0
1 0
1 0
1 0

Output
NO
YES
NO
YES
NO
YES



-----Note-----

In the first test case at the third moment of time the number of clears increased but the number of plays did not, that couldn't have happened.

The second test case is a nice example of a Super Expert level.

In the third test case the number of plays decreased, which is impossible.

The fourth test case is probably an auto level with a single jump over the spike.

In the fifth test case the number of clears decreased, which is also impossible.

Nobody wanted to play the sixth test case; Polycarp's mom attempted it to make him feel better, however, she couldn't clear it.

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Implementation


Solutions:
from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
import bisect, collections, heapq
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def solution():
	n = int(input().strip())
	(plays, clears) = (0, 0)
	possible = True
	for _ in range(n):
		(p, c) = [int(x) for x in input().strip().split()]
		if p < c or p < plays or c < clears or (p - plays < c - clears):
			possible = False
		(plays, clears) = (p, c)
	if possible:
		print('YES')
	else:
		print('NO')

def main():
	T = int(input().strip())
	for _ in range(T):
		solution()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin
input = stdin.readline
q = int(input())
for rwer in range(q):
	n = int(input())
	dasie = True
	pary = [list(map(int, input().split())) for i in range(n)]
	for i in range(1, n):
		if pary[i][0] - pary[i - 1][0] < pary[i][1] - pary[i - 1][1] or pary[i][0] < pary[i - 1][0] or pary[i][1] < pary[i - 1][1]:
			dasie = False
			break
	for i in range(n):
		if pary[i][0] < 0 or pary[i][1] < 0:
			dasie = False
		if pary[i][0] < pary[i][1]:
			dasie = False
	if dasie:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	(pa, pb) = (-1, -1)
	flag = True
	for i in range(n):
		(a, b) = map(int, input().split())
		if a >= pa and b >= pb and (a >= b) and (a - pa >= b - pb):
			(pa, pb) = (a, b)
			continue
		else:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		(last_p, last_c) = [int(i) for i in input().split()]
		flag = True
		if last_p < last_c:
			flag = False
		for q in range(n - 1):
			(p, c) = [int(i) for i in input().split()]
			(diff_p, diff_c) = (p - last_p, c - last_c)
			if p < c or p < last_p or c < last_c or (diff_p < diff_c):
				flag = False
			(last_p, last_c) = (p, c)
		print('YES' if flag else 'NO')
main()


for t in range(int(input())):
	r = 'YES'
	p = c = 0
	for k in range(int(input())):
		(pn, cn) = map(int, input().split())
		if cn < c or cn - c > pn - p:
			r = 'NO'
		(p, c) = (pn, cn)
	print(r)


from math import *
from bisect import bisect_left, bisect_right
from sys import stdin, stdout
from collections import Counter
input = lambda : stdin.readline().strip()
print = stdout.write
T = int(input())
for _ in range(T):
	n = int(input())
	(s1, s2) = ([], [])
	for i in range(n):
		(a, b) = map(int, input().split())
		s1.append(a)
		s2.append(b)
	for i in range(n):
		if s2[i] > s1[i]:
			print('NO\n')
			break
	else:
		for i in range(n - 1):
			if s1[i + 1] < s1[i] or s2[i + 1] < s2[i]:
				print('NO\n')
				break
		else:
			for i in range(n - 1):
				if s1[i + 1] - s1[i] < s2[i + 1] - s2[i]:
					print('NO\n')
					break
			else:
				print('YES\n')


def solve():
	n = int(input())
	points = [(int(number) for number in input().split()) for _ in range(n)]
	(p_prev, c_prev) = points[0]
	if c_prev > p_prev:
		return 'NO'
	for (p_curr, c_curr) in points[1:]:
		if c_curr > p_curr:
			return 'NO'
		if p_curr == p_prev:
			if c_curr != c_prev:
				return 'NO'
		elif p_curr > p_prev:
			if c_prev < c_prev:
				return 'NO'
		else:
			return 'NO'
		delta_p = p_curr - p_prev
		delta_c = c_curr - c_prev
		if delta_p < 0:
			return 'NO'
		if delta_c < 0:
			return 'NO'
		if delta_p < delta_c:
			return 'NO'
		(p_prev, c_prev) = (p_curr, c_curr)
	return 'YES'
task_number = int(input())
for _ in range(task_number):
	print(solve())


for _ in range(int(input())):
	n = int(input())
	plays = list()
	levels = list()
	for _ in range(n):
		(p, l) = map(int, input().split())
		plays.append(p)
		levels.append(l)
	if sorted(plays) != plays:
		print('NO')
	else:
		flag = True
		prev_play = 0
		prev_level = 0
		if prev_level > prev_play:
			flag = False
		else:
			for i in range(n):
				diff_level = levels[i] - prev_level
				diff_plays = plays[i] - prev_play
				if diff_level < 0 or diff_plays < 0:
					flag = False
					break
				if diff_plays < diff_level:
					flag = False
					break
				prev_play = plays[i]
				prev_level = levels[i]
		if flag:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	flag = 1
	for i in range(n):
		if i == 0:
			(play, win) = map(int, input().split())
			if win > play:
				flag = 0
		else:
			(t1, t2) = map(int, input().split())
			if flag:
				if t2 <= t1 and t2 - win >= 0:
					d = t2 - win
					if t1 - play < d:
						flag = 0
					play = t1
					win = t2
				else:
					flag = 0
	if flag == 0:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
t = int(input())
for i in range(t):
	n = int(input())
	l = []
	ans = 'YES'
	for j in range(n):
		l1 = list(map(int, stdin.readline().split()))
		l.append(l1)
		if l1[1] > l1[0]:
			ans = 'NO'
	if n != 1:
		for j in range(1, n):
			if l[j][0] - l[j - 1][0] < l[j][1] - l[j - 1][1]:
				ans = 'NO'
			if l[j][1] < l[j - 1][1]:
				ans = 'NO'
			if l[j][0] < l[j - 1][0]:
				ans = 'NO'
	elif l[0][1] > l[0][0]:
		ans = 'NO'
	print(ans)


import sys, math, cmath, time
start_time = time.time()

def inp():
	return int(input())

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

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())

def solve():
	n = inp()
	a = []
	for i in range(n):
		s = inlt()
		a.append(s)
	a.append(a[-1])
	qw = 'YES'
	q = 0
	w = 0
	for i in range(len(a)):
		qq = a[i][0] - q
		ww = a[i][1] - w
		if a[i][0] < q or a[i][1] < w or a[i][0] < a[i][1] or (ww > qq):
			qw = 'NO'
			break
		q = a[i][0]
		w = a[i][1]
	print(qw)
ONLINE_JUDGE = __debug__
if not ONLINE_JUDGE:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = sys.stdin.readline
t = 1
t = inp()
for tt in range(t):
	solve()
if not ONLINE_JUDGE:
	print('Time Elapsed:', time.time() - start_time, 'seconds')
sys.stdout.close()


t = int(input())
for _ in range(t):
	n = int(input())
	(lastp, lastc) = (0, 0)
	output = 'YES'
	for i in range(n):
		(p, c) = map(int, input().split())
		if output == 'YES':
			if p < c:
				output = 'NO'
				continue
			if p < lastp:
				output = 'NO'
				continue
			if c < lastc:
				output = 'NO'
				continue
			if p - lastp < c - lastc:
				output = 'NO'
				continue
			(lastp, lastc) = (p, c)
	print(output)


import copy
t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	b = []
	flag = 1
	for i in range(n):
		(m, l) = map(int, input().split())
		if l > m:
			flag = 0
		else:
			a.append(m)
			b.append(l)
	if flag == 1:
		c = copy.deepcopy(a)
		d = copy.deepcopy(b)
		c.sort()
		d.sort()
		if a == c and b == d:
			for j in range(1, n):
				if a[j] - a[j - 1] < b[j] - b[j - 1]:
					print('NO')
					flag = 3
					break
			if flag == 1:
				print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
for i in range(n):
	peaks = int(input())
	(p, c) = (0, 0)
	boolean = 0
	for j in range(peaks):
		(p1, c1) = list(map(int, input().split()))
		if boolean == 0:
			if p1 < p or c1 < c or p1 - p < c1 - c:
				boolean = 1
				print('NO')
			else:
				(p, c) = (p1, c1)
	if boolean == 0:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	(a, b) = (0, 0)
	valid = True
	for _ in range(n):
		(x, y) = map(int, input().split())
		if x < y or (x - a < 0 or y - b < 0 or x - a < y - b):
			valid = False
		(a, b) = (x, y)
	if valid:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	x = y = 0
	f = 1
	for i in range(int(input())):
		(p, c) = map(int, input().split())
		f &= 0 <= c - y <= p - x
		x = p
		y = c
	print('NYOE S'[f::2])


def miis():
	return map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	a = [list(miis()) for i in range(n)]
	for i in range(n):
		if a[i][0] < a[i][1]:
			print('NO')
			break
		if i:
			if a[i - 1][0] > a[i][0] or a[i - 1][1] > a[i][1] or a[i][0] - a[i - 1][0] < a[i][1] - a[i - 1][1]:
				print('NO')
				break
	else:
		print('YES')


def is_it_poss(l):
	prev_p = prev_c = 0
	for i in l:
		(p, c) = i
		if prev_p > p or prev_c > c:
			return 'NO'
		if c > p:
			return 'NO'
		plays_diff = p - prev_p
		clears_diff = c - prev_c
		if clears_diff > plays_diff:
			return 'NO'
		prev_p = p
		prev_c = c
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	l = []
	for j in range(n):
		(p, c) = list(map(int, input().split()))
		l.append([p, c])
	print(is_it_poss(l))


t = int(input())
for i in range(t):
	p = []
	c = []
	ans = 'YES'
	c1 = 0
	n = int(input())
	for j in range(n):
		(pi, ci) = map(int, input().split(' '))
		p.append(pi)
		c.append(ci)
	for k in range(len(p)):
		if c[k] > p[k]:
			ans = 'NO'
			c1 = 1
			break
	if c1 == 1:
		print(ans)
	else:
		for k in range(0, len(p) - 1):
			if p[k + 1] < p[k]:
				ans = 'NO'
				break
			elif c[k + 1] < c[k]:
				ans = 'NO'
				break
			elif c[k + 1] - c[k] > p[k + 1] - p[k]:
				ans = 'NO'
				break
		print(ans)


def solve():
	n = list(map(int, input().split()))
	v = []
	n = int(n[0])
	for i in range(n):
		v.append(list(map(int, input().split())))
	c = 0
	for i in range(n):
		if i != 0:
			if v[i][0] >= v[i - 1][0] and v[i][0] - v[i - 1][0] >= v[i][1] - v[i - 1][1] and (v[i][1] >= v[i - 1][1]) and (v[i][0] >= v[i][1]):
				c = 0
			else:
				c = 1
				break
		elif v[i][0] < v[i][1]:
			c = 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')
t = input().split()
t = int(t[0])
for _ in range(t):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	p = []
	c = []
	for i in range(n):
		(p_i, c_i) = map(int, input().split())
		p.append(p_i)
		c.append(c_i)
	dp = p[0]
	dc = c[0]
	if dp - dc < 0:
		print('NO')
	else:
		for i in range(1, n):
			if p[i] - dp < c[i] - dc:
				print('NO')
				break
			if p[i] - dp < 0 or c[i] - dc < 0:
				print('NO')
				break
			if dp - dc < 0:
				print('NO')
				break
			dp = p[i]
			dc = c[i]
		else:
			print('YES')


for _ in range(int(input())):
	n = int(input())
	arr = []
	for i in range(n):
		arr.append(list(map(int, input().split())))
	f = 0
	s = 0
	for (i, j) in arr:
		if i - f < 0 or j - s < 0 or i - f < j - s:
			print('NO')
			break
		f = i
		s = j
	else:
		print('YES')


n = int(input())
for i in range(n):
	t = int(input())
	play = []
	clears = []
	PlayOrder = []
	for j in range(t):
		(x, y) = [int(i) for i in input().split()]
		play.append(x)
		clears.append(y)
	r = 0
	res = 0
	while r < t - 1:
		if clears[r] > clears[r + 1] or play[r] > play[r + 1] or play[r] < clears[r] or (play[r + 1] < clears[r + 1]):
			print('NO')
			res = 1
			break
		if play[r] == play[r + 1] and clears[r] < clears[r + 1]:
			print('NO')
			res = 1
			break
		if play[r + 1] - play[r] < clears[r + 1] - clears[r]:
			print('NO')
			res = 1
			break
		r += 1
	if res == 0:
		if play[0] < clears[0]:
			print('NO')
			res = 1
	if res == 0:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	f = 0
	(x, y) = (-1, -1)
	for i in range(n):
		(p, c) = map(int, input().split())
		if i == 0:
			if p < c:
				f = 1
		elif p < x or c < y or p < c:
			f = 1
		elif p - x < c - y:
			f = 1
		x = p
		y = c
	if f == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	(pp, pc) = map(int, input().split())
	check = 0
	if pp < pc:
		check = 1
	for i in range(n - 1):
		(p, c) = map(int, input().split())
		if c > p or pp > p or c < pc or (p - pp < c - pc):
			check = 1
		elif pp == p and c != pc:
			check = 1
		pp = p
		pc = c
	if check == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	pc = []
	n = int(input())
	for j in range(n):
		(p, c) = map(int, input().split())
		pc.append((p, c))
	good = True
	if n > 1:
		(a, b) = pc[0]
		if a < b:
			good = False
		else:
			for k in range(n - 1):
				(p, c) = pc[k]
				(pn, cn) = pc[k + 1]
				if pn - p < cn - c or (pn - p < 0 or cn - c < 0):
					good = False
	else:
		for k in range(n):
			(p, c) = pc[k]
			if p == 0 and c > 0 or p < c:
				good = False
	if good:
		print('YES')
	else:
		print('NO')


def solve(n, arr):
	if arr[0][0] < arr[0][1]:
		return 'NO'
	for i in range(1, n):
		pl = arr[i][0] - arr[i - 1][0]
		cl = arr[i][1] - arr[i - 1][1]
		if pl < 0 or cl < 0 or pl < cl:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	for __ in range(n):
		(a, b) = map(int, input().split())
		arr.append((a, b))
	ans = solve(n, arr)
	print(ans)


x = int(input())
for i in range(0, x):
	y = int(input())
	possible = True
	max_p = -1
	max_c = -1
	for j in range(0, y):
		a = input().split(' ')
		p = int(a[0])
		c = int(a[1])
		change_p = False
		change_c = False
		if p > max_p:
			change_p_value = p - max_p
			max_p = p
			change_p = True
		elif p < max_p:
			possible = False
		if c > max_c:
			change_c_value = c - max_c
			max_c = c
			change_c = True
		elif c < max_c:
			possible = False
		if change_c == True and change_p == False:
			possible = False
		if change_c == True and change_p == True:
			if change_c_value > change_p_value:
				possible = False
		if c > p:
			possible = False
	if possible:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	pc = [tuple(map(int, input().split())) for _ in range(n)]
	flg = True
	for i in range(n):
		if pc[i][0] < pc[i][1]:
			flg = False
	if flg == False:
		print('NO')
	else:
		for i in range(n - 1):
			dp = pc[i + 1][0] - pc[i][0]
			dc = pc[i + 1][1] - pc[i][1]
			if dp < 0:
				flg = False
			if dp == 0:
				if dc != 0:
					flg = False
			if dp > 0:
				if dp < dc:
					flg = False
				if dc < 0:
					flg = False
		if flg:
			print('YES')
		else:
			print('NO')


def check_stat():
	flag = True
	n = int(input())
	pl = sl = -1
	for i in range(n):
		(p, s) = map(int, input().split())
		delta_p = p - pl
		delta_s = s - sl
		if delta_s > delta_p or pl > p or sl > s:
			flag = False
		pl = p
		sl = s
	return flag
n_sets = int(input())
for i in range(n_sets):
	if check_stat():
		print('YES')
	else:
		print('NO')


def res(n, a):
	for i in range(n):
		if a[i][1] > a[i][0]:
			return 'NO'
		elif i != n - 1:
			if a[i + 1][0] < a[i][0] or a[i + 1][1] < a[i][1]:
				return 'NO'
			elif a[i + 1][0] - a[i][0] < a[i + 1][1] - a[i][1]:
				return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	a = []
	n = int(input())
	for j in range(n):
		temp = [int(x) for x in input().split()]
		a.append(temp)
	print(res(n, a))


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	p_prev = 0
	c_prev = 0
	can = True
	for _ in range(n):
		(pi, ci) = [int(x) for x in input().split()]
		if pi < p_prev:
			can = False
		if ci < c_prev:
			can = False
		if ci > pi:
			can = False
		if pi - p_prev < ci - c_prev:
			can = False
		p_prev = pi
		c_prev = ci
	if not can:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	m = []
	for i in range(n):
		(a, b) = map(int, input().split())
		l.append(a)
		m.append(b)
	p = l[:]
	q = m[:]
	p.sort()
	q.sort()
	f = 1
	if p == l and q == m:
		for i in range(n):
			if i > 0:
				if m[i] > m[i - 1]:
					k = m[i] - m[i - 1]
					if not l[i] - l[i - 1] >= k:
						f = 0
						break
			if l[i] < m[i]:
				f = 0
				break
		if f == 0:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


t = int(input())
while t != 0:
	n = int(input())
	A = []
	B = []
	for k in range(n):
		(p, q) = map(int, input().split())
		A.append(p)
		B.append(q)
	i = 0
	tmp = 0
	if A != sorted(A) or B != sorted(B):
		tmp = 1
	if tmp != 1:
		while i < n:
			if B[i] > A[i]:
				tmp = 1
				break
			i += 1
	if tmp != 1:
		i = 0
		while i < n - 1:
			if B[i + 1] - B[i] > A[i + 1] - A[i]:
				tmp = 1
			i += 1
	if tmp == 1:
		print('NO')
	else:
		print('YES')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	ans = 'YES'
	previous = 0
	for i in range(n):
		if previous == 0:
			previous = list(map(int, input().split()))
			if previous[0] < previous[1]:
				ans = 'NO'
		else:
			new = list(map(int, input().split()))
			if ans != 'NO':
				if new[0] < new[1]:
					ans = 'NO'
				if new[0] < previous[0] or new[1] < previous[1]:
					ans = 'NO'
				if new[0] - new[1] < previous[0] - previous[1]:
					ans = 'NO'
				previous = new
	print(ans)


t = int(input())
while t > 0:
	n = int(input())
	L = []
	flag = 0
	while n > 0:
		(p, c) = list(map(int, input().split()))
		L.append([p, c])
		n -= 1
	if L == sorted(L):
		flag = 1
	counter = 0
	if flag:
		if len(L) > 1:
			for i in range(len(L) - 1):
				if L[i][0] < L[i][1]:
					counter += 1
					break
				elif L[i][0] > L[i + 1][0]:
					counter += 1
					break
				elif L[i][1] > L[i + 1][1]:
					counter += 1
					break
				elif L[i + 1][0] - L[i][0] < L[i + 1][1] - L[i][1]:
					counter += 1
					break
				else:
					continue
		elif p >= c:
			print('YES')
		else:
			print('NO')
		if counter == 0 and len(L) > 1:
			print('YES')
		elif counter > 0 and len(L) > 1:
			print('NO')
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	(ps, cs) = ([0], [0])
	for i in range(n):
		(p, c) = map(int, input().split())
		(ps, cs) = (ps + [p], cs + [c])
	z = 1
	for i in range(1, n + 1):
		if ps[i] >= cs[i]:
			if ps[i] - ps[i - 1] >= cs[i] - cs[i - 1] and ps[i] - ps[i - 1] >= 0 and (cs[i] - cs[i - 1] >= 0):
				continue
			else:
				z = 0
				print('NO')
				break
		else:
			z = 0
			print('NO')
			break
	if z:
		print('YES')


t = int(input())
for tt in range(0, t):
	n = int(input())
	l = []
	for i in range(0, n):
		a = []
		a = list(map(int, input().split()))
		l.append(a)
	flag = 0
	if l[0][0] < l[0][1]:
		print('NO')
	else:
		flag = 1
		for i in range(1, n):
			if l[i][0] < l[i - 1][0] or l[i][1] < l[i - 1][1] or l[i][0] - l[i - 1][0] < l[i][1] - l[i - 1][1]:
				print('NO')
				flag = 0
				break
			elif l[i][0] < l[i][1]:
				print('NO')
				flag = 0
				break
			else:
				flag = 1
		if flag == 1:
			print('YES')


for _ in range(int(input())):
	n = int(input())
	flag = 0
	record = []
	for i in range(n):
		(p, c) = map(int, input().split())
		if i == 0:
			if c > p:
				flag = 1
		elif p < record[-1][0] or c > p or c < record[-1][1] or (p - record[-1][0] < c - record[-1][1]):
			flag = 1
		record.append([p, c])
	if flag:
		print('NO')
	else:
		print('YES')


t = int(input())

def solve():
	n = int(input())
	inp = [[int(x) for x in input().split()] for _ in range(n)]
	(lp, lc) = inp[0]
	if lp < lc:
		return False
	for _ in range(1, n):
		(p, c) = inp[_]
		if p < lp:
			return False
		if c < lc:
			return False
		if c - lc > p - lp:
			return False
		lp = p
		lc = c
	return True
for _ in range(t):
	print(['NO', 'YES'][solve()])


from collections import defaultdict, Counter

def solve():
	n = int(input())
	p = -1
	q = -1
	test = 0
	ls = []
	for i in range(n):
		(x, y) = map(int, input().split())
		ls.append([x, y])
	for [x, y] in ls:
		if p > x:
			test = 1
			break
		elif q > y:
			test = 1
			break
		elif y > q and x == p:
			test = 1
			break
		elif y - q > x - p:
			test = 1
			break
		else:
			p = x
			q = y
	if test:
		print('No')
	else:
		print('YES')
for _ in range(int(input())):
	solve()


for test_i in range(int(input())):
	i1 = 0
	n = int(input())
	arr = []
	ans = True
	(p_prev, c_prev) = (0, 0)
	for i in range(n):
		(p_cur, c_cur) = map(int, input().split())
		if p_cur - p_prev < c_cur - c_prev or p_cur < p_prev or c_cur < c_prev:
			ans = False
			i1 = n - i - 1
			break
		(p_prev, c_prev) = (p_cur, c_cur)
	for i in range(i1):
		input()
	print('YES' if ans else 'NO')


for t in range(int(input())):
	(a, b) = (0, 0)
	ans = 'YES'
	for i in range(int(input())):
		(c, d) = map(int, input().split())
		if c - a < d - b or min(c - a, d - b) < 0:
			ans = 'NO'
		(a, b) = (c, d)
	print(ans)


inp = input()
for i in range(int(inp)):
	n = int(input())
	x = 0
	y = 0
	flag = 1
	for i in range(n):
		(p, q) = map(int, input().split())
		if x > p:
			flag = 0
		elif y > q:
			flag = 0
		elif q - y > p - x:
			flag = 0
		x = p
		y = q
	if flag:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
import bisect

def main():
	for _ in range(int(stdin.readline())):
		(play, clear) = (0, 0)
		counter = 0
		n = int(stdin.readline())
		matrix = []
		for i in range(n):
			(p, c) = map(int, stdin.readline().split())
			matrix.append((p, c))
		for i in range(n):
			p = matrix[i][0]
			c = matrix[i][1]
			pl = p - play
			cl = c - clear
			if cl < 0:
				counter = 1
				break
			elif pl < 0:
				counter = 1
				break
			elif cl > pl:
				counter = 1
				break
			else:
				play = p
				clear = c
				continue
		if counter == 1:
			print('NO')
		else:
			print('YES')
main()


t = int(input())
s = []
for jjj in range(0, t):
	n = int(input())
	q = [0, 0]
	for i in range(0, n):
		(p, c) = map(int, input().split())
		if p >= q[0] and c < q[1] or c > p or p < q[0] or (p == q[0] and c != q[1]) or (p - q[0] < c - q[1]):
			if len(s) != jjj + 1:
				s.append('NO')
		else:
			q[0] = p
			q[1] = c
	if len(s) != jjj + 1:
		s.append('YES')
for i in s:
	print(i)


t = int(input())
for w in range(t):
	n = int(input())
	c = 0
	l = []
	l1 = []
	c1 = 0
	c2 = 0
	for i in range(n):
		(x, y) = (int(i) for i in input().split())
		if x < y:
			c = 1
		elif c1 == 0:
			l.append(x)
			l1.append(y)
			c1 += 1
			c2 += 1
		elif x < l[c1 - 1]:
			c = 1
		elif y < l1[c2 - 1]:
			c = 1
		elif x - l[c1 - 1] < y - l1[c2 - 1]:
			c = 1
		else:
			l.append(x)
			l1.append(y)
			c1 += 1
			c2 += 1
	if c == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	(a, b) = (0, 0)
	res = True
	for _ in range(n):
		(c, d) = list(map(int, input().split()))
		if c < a or d < b or c - a < d - b:
			res = False
		(a, b) = (c, d)
	print('YES' if res else 'NO')


from sys import stdin

def main():
	inp = stdin.readline
	for _ in range(int(inp())):
		n = int(inp())
		(pp, cp) = (0, 0)
		ans = 'YES'
		for i in range(n):
			(p, c) = map(int, inp().split())
			if p >= pp and c <= p and (c >= cp) and (c - cp <= p - pp):
				pp = p
				cp = c
				continue
			else:
				ans = 'NO'
			pp = p
			cp = c
		print(ans)
main()


n_tests = int(input())
for _ in range(n_tests):
	n_times = int(input())
	last_n_play = 0
	last_n_cleared = 0
	last_n_fails = 0
	possible = True
	for t in range(n_times):
		(n_play, n_cleared) = list(map(int, input().split()))
		if not possible:
			continue
		n_fails = n_play - n_cleared
		if n_play < last_n_play:
			possible = False
		elif n_cleared < last_n_cleared:
			possible = False
		elif n_fails < last_n_fails:
			possible = False
		last_n_play = n_play
		last_n_cleared = n_cleared
		last_n_fails = n_fails
	if not possible:
		print('NO')
	else:
		print('YES')


list_ans = []
for _ in range(int(input())):
	n = int(input())
	list1 = []
	for i in range(n):
		list1.append(list(map(int, input().split())))
	if list1[0][0] < list1[0][1]:
		list_ans.append('NO')
	else:
		for i in range(n - 1):
			if list1[i][0] > list1[i + 1][0] or list1[i][1] > list1[i + 1][1] or list1[i + 1][1] - list1[i][1] > list1[i + 1][0] - list1[i][0]:
				list_ans.append('NO')
				break
		else:
			list_ans.append('YES')
for item in list_ans:
	print(item)


for _ in range(int(input())):
	n = int(input())
	f = True
	a = b = 0
	for i in range(n):
		(n, m) = map(int, input().split())
		if n < m:
			f = False
		if n < a or m < b:
			f = False
		if n - a < m - b:
			f = False
		a = n
		b = m
	if f:
		print('YES')
	else:
		print('NO')


def solve():
	n = int(input())
	p = []
	c = []
	for i in range(n):
		(pi, ci) = map(int, input().split())
		p.append(pi)
		c.append(ci)
	if p[0] < c[0]:
		print('NO')
		return 0
	for i in range(1, n):
		if p[i] < p[i - 1] or p[i] < c[i] or c[i] < c[i - 1] or (p[i] - p[i - 1] < c[i] - c[i - 1]):
			print('NO')
			return 0
	print('YES')
	return 0
t = int(input())
for _ in range(t):
	solve()


T = int(input(''))
for _ in range(T):
	n = int(input(''))
	arp = []
	arc = []
	for i in range(n):
		(p, c) = map(int, input().split())
		arp.append(p)
		arc.append(c)
	ans = 'YES'
	for j in range(n):
		if arc[j] > arp[j]:
			ans = 'NO'
			break
	for x in range(1, n):
		if n != 1:
			if arp[x] < arp[x - 1]:
				ans = 'NO'
				break
		if n != 1:
			if arc[x] < arc[x - 1]:
				ans = 'NO'
				break
		if arc[x] == arc[x - 1] + 1 and arp[x] <= arp[x - 1]:
			ans = 'NO'
			break
		if arc[x] - arc[x - 1] > arp[x] - arp[x - 1]:
			ans = 'NO'
			break
	print(ans)


num_test_cases = int(input())
test_cases = []
for test in range(num_test_cases):
	test_case = []
	num_records = int(input())
	test_case.append(num_records)
	list_records = []
	for record in range(num_records):
		list_records.append([int(element) for element in input().split()])
	test_case.append(list_records)
	test_cases.append(test_case)
for test in test_cases:
	result = 'YES'
	rec_list = test[1].copy()
	p_ = 0
	c_ = 0
	for i in range(test[0]):
		p = rec_list[i][0]
		c = rec_list[i][1]
		if p_ > p or c_ > c or c > p or (c - c_ > p - p_):
			result = 'NO'
		p_ = p
		c_ = c
	print(result)


t = int(input())
while t != 0:
	a = int(input())
	c = []
	for i in range(0, a):
		c.append(list(map(int, input().split(' '))))
	if a == 1 and c[0][0] >= c[0][1]:
		print('YES')
	elif a == 1:
		print('NO')
	else:
		w = 0
		for i in range(1, a):
			e = abs(c[i][0] - c[i - 1][0])
			f = abs(c[i][1] - c[i - 1][1])
			if c[i][0] >= c[i - 1][0] and c[i][1] >= c[i - 1][1] and (c[i][1] <= c[i][0]) and (f <= e) and (c[0][0] >= c[0][1]):
				w = w + 1
				continue
			else:
				print('NO')
				break
		if w == a - 1:
			print('YES')
	t = t - 1


def check():
	answer = 'YES'
	p1 = 0
	c1 = 0
	n = int(input())
	for _ in range(n):
		(p, c) = map(int, input().split())
		dp = p - p1
		dc = c - c1
		if not (dp >= dc and dc >= 0):
			answer = 'NO'
		else:
			p1 = p
			c1 = c
	return answer
T = int(input())
for _ in range(T):
	print(check())


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	n = int(input())
	lastP = 0
	lastC = 0
	works = True
	for _ in range(n):
		(p, c) = list(map(int, input().split()))
		pDiff = p - lastP
		cDiff = c - lastC
		if 0 <= cDiff <= pDiff:
			pass
		else:
			works = False
		lastP = p
		lastC = c
	if works:
		print('YES')
	else:
		print('NO')


testCases = int(input())
for _ in range(testCases):
	peek = int(input())
	values = []
	for i1 in range(peek):
		temp = list(map(int, input().split()))
		values.append(temp)
	result = 'YES'
	if values[0][0] < values[0][1]:
		result = 'NO'
	for i1 in range(1, peek, 1):
		playIncrease = values[i1][0] - values[i1 - 1][0]
		clearIncrease = values[i1][1] - values[i1 - 1][1]
		if not (playIncrease >= 0 and clearIncrease >= 0 and (playIncrease >= clearIncrease)):
			result = 'NO'
			break
	print(result)


t = int(input())
for i in range(t):
	n = int(input())
	f = []
	k = 0
	for i in range(n):
		(a, b) = map(int, input().strip().split())
		f.append([a, b])
	if f[0][0] < f[0][1]:
		k = 1
	for i in range(1, n):
		if f[i][0] >= f[i - 1][0] and f[i][1] >= f[i - 1][1] and (f[i][1] - f[i - 1][1] <= f[i][0] - f[i - 1][0]):
			continue
		else:
			k = 1
			break
	if k == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	last = (0, 0)
	done = False
	for _ in range(n):
		(p, c) = [int(i) for i in input().split()]
		if (p < c or (p == last[0] and c != last[1])) and (not done):
			print('NO')
			done = True
		if (p != last[0] or c != last[1]) and (not done):
			if p < last[0] or c < last[1]:
				print('NO')
				done = True
		if (p > last[0] > last[1] and p - last[0] < c - last[1]) and (not done):
			print('NO')
			done = True
		last = (p, c)
	else:
		if not done:
			print('yes')


for _ in range(int(input())):
	n = int(input())
	(pi, ci) = map(int, input().split())
	flag = True
	if ci > pi:
		flag = False
	pc = [[pi, ci]]
	for i in range(1, n):
		(pi, ci) = map(int, input().split())
		if ci > pi or pi < pc[-1][0] or ci < pc[-1][1] or (pi - pc[-1][0] < ci - pc[-1][1]):
			flag = False
		pc.append([pi, ci])
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	(x, y, ans) = ([0] * n, [0] * n, 1)
	for i in range(n):
		(x[i], y[i]) = map(int, input().split())
		if i > 0 and (x[i] < x[i - 1] or y[i] < y[i - 1]):
			ans = 0
		if i > 0 and x[i] - x[i - 1] < y[i] - y[i - 1]:
			ans = 0
		if x[i] < y[i]:
			ans = 0
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	rec = []
	for _1 in range(n):
		rec.append(list(map(int, input().split())))
	(lp, lc) = (0, 0)
	fail = False
	for i in rec:
		p = i[0]
		c = i[1]
		if p < lp or c < lc or c - lc > p - lp:
			fail = True
			break
		else:
			lp = p
			lc = c
	if fail:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	prev_p = prev_c = 0
	ans = 'YES'
	for _ in range(n):
		(curr_p, curr_c) = map(int, input().split())
		if curr_p < prev_p:
			ans = 'NO'
		elif curr_p > prev_p:
			if curr_c < prev_c:
				ans = 'NO'
			if curr_p - prev_p < curr_c - prev_c:
				ans = 'NO'
		elif prev_c != curr_c:
			ans = 'NO'
		(prev_p, prev_c) = (curr_p, curr_c)
	print(ans)


def stat():
	n = int(input())
	(mp, mc) = (-1, -1)
	r = 'YES'
	for i in range(n):
		(p, c) = list(map(int, input().split()))
		if c > p:
			r = 'NO'
		elif p < mp:
			r = 'NO'
		elif c < mc:
			r = 'NO'
		elif p - mp < c - mc:
			r = 'NO'
		(mp, mc) = (p, c)
	return r
for _ in range(int(input())):
	print(stat())


t = int(input())
for _ in range(t):
	n = int(input())
	lastp = -1
	lastc = -1
	lastgap = 0
	skip = False
	for i in range(n):
		(p, c) = map(int, input().split())
		if skip:
			continue
		if p < lastp or p < c or c < lastc or (p - c < lastgap):
			print('NO')
			skip = True
		(lastp, lastc) = (p, c)
		lastgap = p - c
	if not skip:
		print('YES')


n = int(input())
for i in range(n):
	nn = int(input())
	arr = [[0, 0]]
	for i in range(nn):
		temp = [int(i) for i in input().split()]
		arr.append(temp)
	for i in range(1, len(arr)):
		if arr[i][0] >= arr[i][1] and arr[i][0] >= arr[i - 1][0] and (arr[i][1] >= arr[i - 1][1]) and (arr[i][0] - arr[i - 1][0] >= arr[i][1] - arr[i - 1][1]):
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


mod = 10 ** 9 + 7
import math
from bisect import bisect_left
from collections import Counter
from itertools import combinations

def ain():
	return map(int, input().split())

def fain():
	return map(float, input().split())

def mc2(s):
	return s * (s - 1) // 2 + s
for tc in range(int(input())):
	n = int(input())
	pos = True
	a = 0
	b = 0
	for i in range(n):
		(c, d) = ain()
		if i == 0:
			if c < d:
				pos = False
		elif c < d or c < a or d < b or (d - b > c - a):
			pos = False
		(a, b) = (c, d)
	if pos:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	(current_plays, current_clears) = (0, 0)
	possible = True
	for i in range(n):
		(plays, clears) = map(int, input().split(' '))
		dp = plays - current_plays
		dc = clears - current_clears
		if dp >= 0 and dc >= 0:
			if dp >= dc:
				current_clears = clears
				current_plays = plays
				continue
			else:
				possible = False
				continue
		else:
			possible = False
	print('YES' if possible else 'NO')


t = int(input())
for _ in range(t):
	k = int(input())
	nd = 0
	nn = 0
	ans = 1
	nm = 0
	for i in range(k):
		(n, m) = map(int, input().split())
		d = n - m
		if nd > d or nn > n or nm > m or (d < 0):
			ans = 0
		else:
			nd = d
			nn = n
			nm = m
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	(a, b) = (0, 0)
	f = False
	br = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if p >= a and c >= b and (p - a >= c - b) and (p >= c) and (br == 0):
			f = True
		else:
			f = False
			br = 1
		(a, b) = (p, c)
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = []
	for i in range(n):
		s.append(list(map(int, input().split())))
	ok = True
	for i in range(n):
		for j in range(i, n):
			if s[i][0] == s[j][0] and s[i][1] != s[j][1]:
				ok = False
				break
			if s[i][1] > s[j][1]:
				ok = False
				break
			if s[i][0] > s[j][0]:
				ok = False
				break
			if s[i][0] < s[i][1] or s[j][0] < s[j][1]:
				ok = False
				break
			if s[j][0] - s[i][0] < s[j][1] - s[i][1]:
				ok = False
				break
		if not ok:
			break
	if ok:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, size, link):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().split()))
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	n = int(input())
	a = []
	for __ in range(n):
		a.append(int_array())
	(p, c) = (0, 0)
	flag = 1
	for i in range(n):
		dp = a[i][0] - p
		dc = a[i][1] - c
		(p, c) = a[i]
		if dp < dc or dp < 0 or dc < 0:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	pc = []
	(a, b) = (0, 0)
	for i in range(n):
		(x, y) = map(int, input().split())
		pc.append((x, y))
	ans = ''
	for (x, y) in pc:
		if x < a or y < b or x - a < y - b:
			ans = 'NO'
			break
		ans = 'YES'
		a = x
		b = y
	print(ans)


x = int(input())
l = []
for z in range(x):
	n = int(input())
	l.clear()
	for i in range(n):
		c = list(map(int, input().split()))
		l.append(c)
	f = 0
	if l[0][1] > l[0][0]:
		print('NO')
		f = 2
	elif n == 1:
		print('YES')
		f = 2
	else:
		for i in range(n - 1):
			if l[i + 1][0] < l[i][0] or l[i + 1][1] < l[i][1]:
				print('NO')
				f = 1
				break
			elif l[i + 1][0] - l[i][0] < l[i + 1][1] - l[i][1]:
				print('NO')
				f = 1
				break
		if f == 0:
			print('YES')


def level_statistics():
	cases = int(input())
	level_stats = []
	clears = []
	for i in range(cases):
		level_stats.append(int(input()))
		for j in range(level_stats[i]):
			clears.append(list(map(int, input().split())))
	for i in range(len(level_stats)):
		players = clears[0][0]
		completed = clears[0][1]
		clears.pop(0)
		if level_stats[i] == 1:
			if players >= completed:
				print('YES')
			else:
				print('NO')
			continue
		if completed > players or players < 0 or completed < 0:
			print('NO')
			for j in range(level_stats[i] - 1):
				clears.pop(0)
			continue
		found = True
		for j in range(level_stats[i] - 1):
			temp_players = clears[0][0]
			temp_completed = clears[0][1]
			clears.pop(0)
			if found:
				if temp_players < players or temp_completed < completed:
					print('NO')
					found = False
					continue
				if temp_players == players and temp_completed != completed:
					print('NO')
					found = False
					continue
				if temp_completed > completed:
					more = temp_completed - completed
					if players + more > temp_players:
						print('NO')
						found = False
						continue
				players = temp_players
				completed = temp_completed
				if completed > players:
					print('NO')
					found = False
		if found:
			print('YES')
level_statistics()


for t in range(int(input())):
	(play, clear) = ([], [])
	for i in range(int(input())):
		(p, c) = map(int, input().split())
		play.append(p)
		clear.append(c)
	play.insert(0, -1)
	clear.insert(0, -1)
	for i in range(1, len(play)):
		if play[i] >= clear[i]:
			if play[i] >= play[i - 1] and clear[i] >= clear[i - 1]:
				(a, b) = (play[i] - play[i - 1], clear[i] - clear[i - 1])
				if b > a:
					print('NO')
					break
				elif i == len(play) - 1:
					print('YES')
			else:
				print('NO')
				break
		else:
			print('NO')
			break


from sys import stdin
inp = stdin.readline
t = int(inp().strip())
for _ in range(t):
	n = int(inp().strip())
	a = []
	prevP = 0
	prevC = 0
	for i in range(n):
		a.append([int(x) for x in inp().strip().split()])
	for i in range(n):
		if a[i][0] < a[i][1]:
			print('NO')
			break
		elif a[i][0] < prevP:
			print('NO')
			break
		elif a[i][1] < prevC:
			print('NO')
			break
		elif a[i][1] - prevC > a[i][0] - prevP:
			print('NO')
			break
		prevC = a[i][1]
		prevP = a[i][0]
	else:
		print('YES')


t = int(input())

def get_list():
	raw_input = input() + ' '
	input_list = []
	d = 0
	for i in range(len(raw_input)):
		if raw_input[i] != ' ':
			d += 1
		elif raw_input[i] == ' ':
			input_list.append(int(raw_input[i - d:i]))
			d = 0
	return input_list
while t > 0:
	n = int(input())
	data = []
	for i in range(n):
		data.append(get_list())
	valid = True
	if data[0][0] < data[0][1]:
		valid = False
	for i in range(n - 1):
		if data[i + 1][0] - data[i][0] < 0 or data[i + 1][1] - data[i][1] < 0 or data[i + 1][0] - data[i][0] < data[i + 1][1] - data[i][1]:
			valid = False
	if valid:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	ans = 'yes'
	l1 = []
	for i in range(n):
		l1.append([int(x) for x in input().split()])
	for i in range(1, n):
		if l1[i][0] < l1[i - 1][0]:
			ans = 'no'
			break
		elif l1[i][1] < l1[i - 1][1]:
			ans = 'no'
			break
		elif l1[i][0] == l1[i - 1][0] and l1[i][1] != l1[i - 1][1]:
			ans = 'no'
			break
		elif l1[i][1] > l1[i][0]:
			ans = 'no'
		elif l1[i][1] - l1[i - 1][1] > l1[i][0] - l1[i - 1][0]:
			ans = 'no'
	if l1[0][1] > l1[0][0]:
		ans = 'NO'
	print(ans)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	ans = True
	inp = []
	for i in range(0, n):
		(x, y) = map(int, input().strip().split(' '))
		inp.append((x, y))
	if inp[0][0] < inp[0][1]:
		ans = False
	for i in range(1, n):
		if inp[i][0] == inp[i - 1][0]:
			if inp[i][1] != inp[i - 1][1]:
				ans = False
		if inp[i][0] < inp[i][1]:
			ans = False
		if inp[i][0] < inp[i - 1][0]:
			ans = False
		if inp[i][1] < inp[i - 1][1]:
			ans = False
		if inp[i][0] - inp[i - 1][0] < inp[i][1] - inp[i - 1][1]:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	pc = []
	for j in range(n):
		pc.append(list(map(int, input().split())))
	prevp = 0
	prevc = 0
	flag = False
	for j in range(n):
		if pc[j][0] < prevp or pc[j][1] < prevc or pc[j][0] - prevp < pc[j][1] - prevc:
			flag = True
		prevp = pc[j][0]
		prevc = pc[j][1]
	print('NO' if flag else 'YES')


for _ in range(int(input())):
	n = int(input())
	arr = []
	flag = True
	cp = 0
	cl = 0
	for _ in range(n):
		(plays, clears) = [int(x) for x in input().split(' ')]
		arr.append([plays, clears])
		if cp <= plays and cl <= clears and (plays >= clears) and (plays - cp >= clears - cl):
			cp = plays
			cl = clears
		else:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	(p, c) = (0, 0)
	flag = True
	for i in range(n):
		(a, b) = map(int, input().split())
		if a < p or b < c:
			flag = False
		elif a - p < b - c:
			flag = False
		p = a
		c = b
	if not flag:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	check = True
	pl = 0
	cl = 0
	for j in range(int(input())):
		(p, c) = map(int, input().split())
		if p - pl < c - cl or c < cl or p < pl:
			check = False
		pl = p
		cl = c
	print('YNEOS'[1 - check::2])


for _ in range(int(input())):
	n = int(input())
	(lp, lc) = map(int, input().split())
	ans = lc <= lp
	for _ in range(n - 1):
		(p, c) = map(int, input().split())
		pp = p - lp
		cc = c - lc
		if pp < 0 or cc < 0 or pp < cc or (c > p):
			ans &= False
		lp = p
		lc = c
	print('YES' if ans else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	info = [tuple(map(int, input().split())) for _ in range(n)]
	(pp, pc) = (0, 0)
	for (p, c) in info:
		if p < pp or c < pc:
			print('NO')
			break
		if p - pp < c - pc:
			print('NO')
			break
		(pp, pc) = (p, c)
	else:
		print('YES')


t = int(input())
for x in range(t):
	n = int(input())
	a = 0
	b = 0
	deff = 0
	for i in range(n):
		(n, k) = list(map(int, input().split()))
		if n - a < 0 and deff == 0:
			print('NO')
			deff = 1
		if k - b < 0 and deff == 0:
			print('NO')
			deff = 1
		if n - a < k - b and deff == 0:
			print('NO')
			deff = 1
		a = int(n)
		b = int(k)
	if deff == 0:
		print('YES')


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	valid = True
	preva = 0
	prevb = 0
	for i in range(n):
		(a, b) = map(int, stdin.readline().split())
		if a < preva or b < prevb or b - prevb > a - preva:
			if valid:
				print('NO')
				valid = False
		preva = a
		prevb = b
	if valid:
		print('YES')


import sys
readLine = lambda : sys.stdin.readline()
readInt = lambda : int(sys.stdin.readline())
readInts = lambda : [int(x) for x in sys.stdin.readline().split(' ')]

def main():
	solns = []
	t = readInt()
	for _ in range(t):
		n = readInt()
		valid = True
		(p, c) = readInts()
		if c > p:
			valid = False
		for l in range(1, n):
			(nextP, nextC) = readInts()
			if nextC - c > nextP - p:
				valid = False
			if nextC < c:
				valid = False
			if nextP < p:
				valid = False
			p = nextP
			c = nextC
		solns.append('YES' if valid else 'NO')
	print('\n'.join(solns))
main()


t = int(input())
for j in range(t):
	imposs = 0
	n = int(input())
	(pprev, cprev) = map(int, input().split())
	if cprev > pprev:
		imposs = 1
	for i in range(1, n):
		(p, c) = map(int, input().split())
		pdiff = p - pprev
		cdiff = c - cprev
		if imposs == 0:
			if c > p or cdiff < 0 or pdiff < 0 or (cdiff > pdiff):
				imposs = 1
			cprev = c
			pprev = p
	if imposs == 1:
		print('NO')
	else:
		print('YES')


from math import *
for zz in range(int(input())):
	n = int(input())
	(p1, c1) = map(int, input().split())
	ha = True
	if p1 < c1:
		ha = False
	for i in range(n - 1):
		(p, c) = map(int, input().split())
		if p - p1 < c - c1 or p < p1 or c < c1:
			ha = False
		p1 = p
		c1 = c
	if ha:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	s = []
	for i in range(n):
		l = input().split()
		s.append(l)
		p = -1
		c = -1
	flag = 0
	for i in range(n):
		p2 = int(s[i][0])
		c2 = int(s[i][1])
		if c2 > p2 or p2 < p or c2 < c or (p2 - p < c2 - c):
			print('NO')
			flag = 1
			break
		p = p2
		c = c2
	if flag == 0:
		print('YES')


for i in range(int(input())):
	n = int(input())
	x = 0
	y = 0
	check = 0
	for j in range(n):
		(p, c) = map(int, input().split())
		if p >= x and c >= y:
			if c - y <= p - x:
				x = p
				y = c
			else:
				check = 1
		else:
			check = 1
	if check == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	res = 'YES'
	prev_p = prev_c = -1
	for i in range(n):
		(p, c) = map(int, input().split())
		if c > p:
			res = 'NO'
		if prev_c > c:
			res = 'NO'
		if prev_p > p:
			res = 'NO'
		if p - prev_p < c - prev_c:
			res = 'NO'
		prev_c = c
		prev_p = p
	print(res)


t = int(input())
for j in range(t):
	n = int(input())
	p = []
	c = []
	d = 0
	for i in range(n):
		l = list(map(int, input().split()))
		p.append(l[0])
		c.append(l[1])
	if n > 1:
		for i in range(1, n):
			if p[i] >= c[i] and p[i] >= p[i - 1] and (c[i] >= c[i - 1]) and (p[i] - p[i - 1] >= c[i] - c[i - 1]):
				d += 1
		if d == n - 1 and p[0] >= c[0]:
			print('YES')
		else:
			print('NO')
	elif p[0] >= c[0]:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	(x, y) = (0, 0)
	flag = True
	for k in range(n):
		(a, b) = map(int, input().split())
		if x > a or y > b or a - x < b - y:
			flag = False
		(x, y) = (a, b)
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	flag = 0
	(pg, pc) = map(int, input().split())
	if pc > pg:
		for i in range(n - 1):
			(g, c) = map(int, input().split())
		print('NO')
	else:
		for i in range(n - 1):
			(g, c) = map(int, input().split())
			if c > g or c - pc > g - pg or pg > g or (pc > c):
				flag = 1
			else:
				pg = g
				pc = c
		if flag == 0:
			print('YES')
		else:
			print('NO')
	t -= 1


from sys import stdin, stdout

def read():
	x0 = stdin.readline().rstrip()
	return x0

def __main__():
	t = int(read())
	for t0 in range(t):
		n = int(read().strip())
		p0 = 0
		c0 = 0
		fl = True
		for n0 in range(n):
			(p, c) = map(int, read().split())
			if p - p0 < c - c0 or p < p0 or c < c0:
				fl = False
			p0 = p
			c0 = c
		if fl:
			out = 'YES\n'
		else:
			out = 'NO\n'
		stdout.write(out)
__main__()


R = lambda : map(int, input().split())

def solver(n, arr):
	prev = [0, 0]
	for i in range(n):
		cur = arr[i]
		(diff_play, diff_clear) = (cur[0] - prev[0], cur[1] - prev[1])
		if diff_play < 0 or diff_clear < 0:
			return False
		if diff_clear > diff_play:
			return False
		prev = cur
	return True

def main():
	T = int(input())
	for t in range(1, T + 1):
		n = int(input())
		pairs = []
		for _ in range(n):
			pairs.append(list(R()))
		ans = 'YES' if solver(n, pairs) else 'NO'
		print(ans)
main()


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = []
	for i in range(n):
		a.append(list(map(int, input().split())))
	if n == 1:
		if a[0][0] >= a[0][1]:
			print('YES')
		else:
			print('NO')
		continue
	for i in range(1, n):
		plays = a[i][0] - a[i - 1][0]
		clears = a[i][1] - a[i - 1][1]
		if not (a[i][0] >= a[i][1] and plays >= 0 and (clears >= 0) and (plays >= clears)):
			print('NO')
			break
	else:
		if a[0][0] >= a[0][1]:
			print('YES')
		else:
			print('NO')


num1 = int(input())
for _u in range(num1):
	num2 = int(input())
	ans1 = 0
	ans2 = 0
	bool1 = 'YES'
	for _u1 in range(num2):
		(a, b) = map(int, input().split())
		if a < ans1 or b < ans2 or b - ans2 > a - ans1:
			bool1 = 'NO'
		ans1 = a
		ans2 = b
	print(bool1)


I = input
for _ in [0] * int(I()):
	(a, b) = ([], [])
	for _ in [0] * int(I()):
		(p, c) = map(int, I().split())
		a += (p,)
		b += (c,)
	print('NYOE S'[all((0 <= y - x <= v - u for (u, v, x, y) in zip([0] + a, a, [0] + b, b)))::2])


t = int(input())
for _ in range(t):
	n = int(input())
	p = [0] * n
	c = [0] * n
	for i in range(n):
		(p[i], c[i]) = map(int, input().split())
	i = 0
	flag = 0
	if n == 1 and p[0] >= c[0]:
		print('yes')
		continue
	while p[i] >= c[i] and c[i + 1] >= c[i] and (p[i + 1] >= p[i]):
		if c[i + 1] - c[i] > p[i + 1] - p[i]:
			break
		if i == n - 2:
			flag = 1
			break
		i += 1
	if flag and p[n - 1] >= c[n - 1]:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	ans = ''
	n = int(input())
	for j in range(n):
		(a, b) = map(int, input().split())
		if j == 0:
			(a_prev, b_prev) = (a, b)
			dif = a - b
			if dif < 0:
				ans = 'NO'
		elif a - b < dif or a < a_prev or b < b_prev:
			ans = 'NO'
		else:
			(a_prev, b_prev) = (a, b)
			dif = a - b
		if j == n - 1:
			print('YES') if ans == '' else print(ans)


from sys import stdin

def solve(moments, n):
	if not moments[0][0] >= moments[0][1]:
		return False
	for i in range(1, n):
		if not (moments[i][0] >= moments[i - 1][0] and moments[i][1] >= moments[i - 1][1] and (moments[i][1] - moments[i - 1][1] <= moments[i][0] - moments[i - 1][0])):
			return False
	return True

def main():
	r = stdin.readline
	cases = int(r())
	for case in range(cases):
		attempts = list()
		n = int(r())
		for i in range(n):
			attempts.append(tuple(map(int, r().strip().split())))
		print('YES' if solve(attempts, n) else 'NO')
main()


t = int(input())
for _ in range(t):
	valid = True
	n = int(input())
	(lasta, lastb) = [int(x) for x in input().split()]
	if lasta < lastb:
		valid = False
	for __ in range(n - 1):
		(a, b) = [int(x) for x in input().split()]
		if a < b or a < lasta or b < lastb or (a - lasta < b - lastb):
			valid = False
		(lasta, lastb) = (a, b)
	if valid:
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	n = int(input())
	p = 0
	c = 0
	g = True
	for i in range(n):
		(p1, c1) = map(int, input().split())
		dp = p1 - p
		dc = c1 - c
		p = p1
		c = c1
		if dp < dc:
			g = False
		if dp < 0 or dc < 0:
			g = False
	if g:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	(lastc, lastp) = (0, 0)
	ok = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < c:
			ok = False
		if lastp > p or lastc > c:
			ok = False
		elif p - lastp < c - lastc:
			ok = False
		(lastc, lastp) = (c, p)
	print('YES' if ok else 'NO')


for _ in range(int(input())):
	n = int(input())
	f = True
	p = 0
	c = 0
	for i in range(n):
		(pi, ci) = map(int, input().split())
		if ci > pi or p > pi or c > ci or (pi - p < ci - c):
			f = False
		p = pi
		c = ci
	if f:
		print('yes')
	else:
		print('no')


T = int(input())
for dfssa in range(T):
	n = int(input())
	pAnt = 0
	cAnt = 0
	isIt = True
	for dgsdg in range(n):
		(p, c) = list(map(int, input().split()))
		if c - cAnt > p - pAnt or c < cAnt or p < pAnt:
			isIt = False
		pAnt = p
		cAnt = c
	print('YES' if isIt else 'NO')


def lst(l1, l2):
	c = 0
	if len(l1) == 1:
		if l1[0] > 0 and l2[0] <= l1[0]:
			print('yes')
			return
		elif l1[0] == 0 and l2[0] == 0:
			print('yes')
			return
		else:
			print('no')
			return
	for i in range(len(l1) - 1):
		if l1[i + 1] > l1[i] and l2[i + 1] >= l2[i] and (l1[i] >= l2[i]) and (l1[i + 1] - l1[i] >= l2[i + 1] - l2[i]):
			c = c + 1
		elif l1[i + 1] == l1[i] and l2[i + 1] == l2[i]:
			c = c + 1
	p = 0
	if l1[len(l1) - 1] >= l2[len(l2) - 1]:
		p = 1
	if c == len(l1) - 1 and p == 1:
		print('yes')
	else:
		print('no')
	return
t = int(input())
for i in range(t):
	T = int(input())
	l1 = []
	l2 = []
	for j in range(T):
		n = input()
		l = list(map(int, n.split(' ')))
		l1.append(l[0])
		l2.append(l[1])
	lst(l1, l2)


t = int(input())
for i in range(t):
	N = int(input())
	pairs = []
	for j in range(N):
		(x, y) = map(int, input().split())
		pairs.append((x, y))
	(c_x, c_y) = (0, 0)
	no = 0
	for pair in pairs:
		(x, y) = (pair[0], pair[1])
		dif_p = x - c_x
		dif_c = y - c_y
		if dif_p < dif_c or dif_p < 0 or dif_c < 0:
			print('NO')
			no = 1
			break
		c_x = x
		c_y = y
	if not no:
		print('YES')


for t in range(int(input())):
	n = int(input())
	ans = 'YES'
	pcount = 0
	ccount = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < pcount or c < ccount or c - ccount > p - pcount:
			ans = 'NO'
		else:
			pcount = p
			ccount = c
	print(ans)


from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
	return int(input())

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

def solve():
	n = ri()
	fail = False
	(p, c) = rl()
	if c > p:
		fail = True
	for i in range(n - 1):
		(np, nc) = rl()
		if np < p or nc < c:
			fail = True
		if nc > np:
			fail = True
		if nc - c > np - p:
			fail = True
		(p, c) = (np, nc)
	if fail:
		print('NO')
	else:
		print('YES')
mode = 'T'
if mode == 'T':
	t = ri()
	for i in range(t):
		solve()
else:
	solve()


Q = int(input())
sz1 = []
sz2 = []
for i in range(Q):
	a = int(input())
	del sz1[:]
	del sz2[:]
	B = 0
	for m in range(a):
		t = list(map(int, input().split()))
		sz1.append(t[0])
		sz2.append(t[1])
		if sz1[m] < sz1[m - 1] or sz2[m] < sz2[m - 1] or sz2[m] > sz1[m] or (sz2[m] - sz2[m - 1] > sz1[m] - sz1[m - 1]):
			B = 1
	if B == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	for j in range(n):
		(p, c) = map(int, input().split())
		l.append((p, c))
	s = l[0][0]
	e = l[0][1]
	verdict = True
	if s < e:
		verdict = False
	if verdict:
		for i in l[1:]:
			if i[0] < i[1]:
				verdict = False
				break
			if i[0] < s:
				verdict = False
				break
			if i[1] < e:
				verdict = False
				break
			if i[1] - e > i[0] - s:
				verdict = False
				break
			s = i[0]
			e = i[1]
	if verdict:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	c = 0
	(a, b) = (0, 0)
	for _ in range(n):
		(x, y) = map(int, input().split())
		if x < a or y < b or y - b > x - a:
			c = 1
		(a, b) = (x, y)
	if c == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	status = 'YES'
	prevP = 0
	prevC = 0
	for _ in range(int(input())):
		(p, c) = map(int, input().split())
		if prevP <= p and p - prevP >= c - prevC and (c >= prevC) and (status == 'YES'):
			status = 'YES'
		else:
			status = 'NO'
		prevP = p
		prevC = c
	print(status)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	seq = [list(map(int, sys.stdin.readline().split())) for _ in range(n)]
	prevTry = 0
	prevClear = 0
	res = 'YES'
	for s in seq:
		if s[0] < s[1]:
			res = 'NO'
			break
		if s[0] < prevTry or s[1] < prevClear:
			res = 'NO'
			break
		if s[0] == prevTry and s[1] > prevClear:
			res = 'NO'
			break
		if s[0] - prevTry < s[1] - prevClear:
			res = 'NO'
			break
		prevTry = s[0]
		prevClear = s[1]
	print(res)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	play = 0
	clear = 0
	ok = True
	for _ in range(n):
		(p, c) = map(int, input().split())
		if p < play or c < clear:
			ok = False
		if c - clear > p - play:
			ok = False
		play = p
		clear = c
	if ok:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	d = 0
	z = 0
	x = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		if (a < z or b < x) or b - x > a - z:
			d += 1
		else:
			z = a
			x = b
	if d == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	(pp, pc) = (0, 0)
	f = 0
	for i in range(n):
		(pi, ci) = map(int, input().split())
		if pi >= pp and ci >= pc and (pi >= ci) and (pi - pp >= ci - pc):
			(pp, pc) = (pi, ci)
		else:
			f = 1
	if f == 1:
		print('NO')
	else:
		print('YES')


CASES = int(input())
answers = []
while CASES:
	possible = 'YES'
	CASES -= 1
	pr_played = 0
	pr_cleared = 0
	N = int(input())
	for i in range(N):
		(played, cleared) = [int(x) for x in input().split(' ')]
		if played < cleared or played < pr_played or cleared < pr_cleared or (cleared - pr_cleared > played - pr_played):
			possible = 'NO'
		pr_cleared = cleared
		pr_played = played
	answers.append(possible)
for ans in answers:
	print(ans)


def NO():
	return print('NO')

def YES():
	return print('YES')

def INT():
	return int(input())

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

def STR():
	return input()

def MAP():
	return map(int, input().split())
for _ in range(INT()):
	n = INT()
	tries = []
	won = []
	check = False
	for i in range(n):
		(p, c) = MAP()
		tries.append(p)
		won.append(c)
	if n == 1:
		buff = tries[i]
		wins = won[i]
		if wins > buff:
			NO()
			check = True
	else:
		for i in range(n - 1):
			buff = tries[i]
			wins = won[i]
			if buff > tries[i + 1] or wins > buff or tries[i + 1] - buff < won[i + 1] - wins or (won[i + 1] < wins) or (tries[i + 1] < buff):
				NO()
				check = True
				break
	if not check:
		YES()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for t in range(int(input())):
	(pi, ci) = (0, 0)
	flag = 1
	for i in range(int(input())):
		(p, c) = list(map(int, input().split()))
		dp = p - pi
		dc = c - ci
		(pi, ci) = (p, c)
		if flag == 1:
			if dp >= dc:
				flag = 1
			else:
				flag = 0
			if dc < 0 or dp < 0:
				flag = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	p = [0 for i in range(n + 1)]
	c = [0 for i in range(n + 1)]
	(p_diff, c_diff) = (0, 0)
	for i in range(n):
		(p[i + 1], c[i + 1]) = map(int, input().split())
	flag = True
	for i in range(n):
		p_diff = p[i + 1] - p[i]
		c_diff = c[i + 1] - c[i]
		if p_diff < 0 or c_diff < 0 or p_diff < c_diff:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


import sys

def ii():
	return sys.stdin.readline().strip()

def idata():
	return [int(x) for x in ii().split()]

def solve_of_problem():
	n = int(ii())
	(p, c) = (0, 0)
	flag = True
	for i in range(n):
		(p1, c1) = idata()
		if flag and (p1 < p or c1 < c or p1 + c < c1 + p):
			print('NO')
			flag = False
		(p, c) = (p1, c1)
	if flag:
		print('YES')
	return
for ______ in range(int(ii())):
	solve_of_problem()


t = int(input())
out = ''
while t > 0:
	t -= 1
	n = int(input())
	prev_p = prev_c = 0
	good = True
	ok_plays = 0
	for i in range(n):
		(p, c) = [int(i) for i in input().split(' ')]
		if c > p:
			good = False
		if c - prev_c > p - prev_p:
			good = False
		if c < prev_c:
			good = False
		if p < prev_p:
			good = False
		prev_p = p
		prev_c = c
	if good:
		out += 'YES\n'
		continue
	out += 'NO\n'
print(out)


t = int(input())
for i in range(t):
	n = int(input())
	(c, d) = (0, 0)
	k = True
	for j in range(n):
		(a, b) = map(int, input().split())
		if a < c or b < d or b > a or (a - c < b - d):
			k = False
		(c, d) = (a, b)
	if k is True:
		print('Yes')
	else:
		print('No')


t = int(input())
for k in range(t):
	v1 = 0
	v2 = 0
	flag = 0
	n = input()
	n = int(n)
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < c or p < v1 or c < v2 or (c - v2 > p - v1):
			flag = 1
		v1 = max(p, v1)
		v2 = max(c, v2)
	if flag == 0:
		print('YES')
	else:
		print('NO')


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	(a, b) = (0, 0)
	bad = False
	for i in range(mint()):
		(c, d) = mints()
		(da, db) = (c - a, d - b)
		if da < 0 or db < 0:
			bad = True
		if da < db:
			bad = True
		a = c
		b = d
	print(['YES', 'NO'][bad])
for i in range(mint()):
	solve()


for _ in range(int(input())):
	p = 0
	c = 0
	ans = True
	for _ in range(int(input())):
		(x, y) = list(map(int, input().split()))
		if x < p or y < c or y - c > x - p:
			ans = False
		else:
			(p, c) = (x, y)
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [list(map(int, input().split())) for _ in range(n)]
	if arr[0][0] < arr[0][1]:
		print('NO')
		continue
	for i in range(n - 1):
		if arr[i + 1][0] < arr[i + 1][1]:
			print('NO')
			break
		if arr[i + 1][0] < arr[i][0] or arr[i + 1][1] < arr[i][1]:
			print('NO')
			break
		if arr[i + 1][1] > arr[i][1] and arr[i + 1][0] - arr[i][0] < arr[i + 1][1] - arr[i][1]:
			print('NO')
			break
	else:
		print('YES')


n = int(input())
for _ in range(n):
	ntests = int(input())
	tests = []
	for i in range(ntests):
		(p, c) = map(lambda x: int(x), input().split(' '))
		tests.append([p, c])
	prev_test = tests[0]
	if prev_test[1] > prev_test[0]:
		print('NO')
		continue
	skip = False
	for test in tests[1:]:
		if test[0] < prev_test[0]:
			print('NO')
			skip = True
			break
		if test[1] < prev_test[1]:
			print('NO')
			skip = True
			break
		if test[1] > prev_test[1] and test[0] <= prev_test[0]:
			print('NO')
			skip = True
			break
		if test[0] > prev_test[0]:
			if test[1] > prev_test[1] + test[0] - prev_test[0]:
				print('NO')
				skip = True
				break
		if test[1] > test[0]:
			print('NO')
			skip = True
			break
		prev_test = test
	if not skip:
		print('YES')


a = int(input())
for i in range(a):
	flag = 0
	s = int(input())
	ma1 = 0
	ma2 = 0
	ans = []
	q = 0
	r = 0
	for i in range(s):
		(x, y) = map(int, input().split())
		ans.append([x, y])
	for i in range(len(ans)):
		if ans[i][0] - q < 0:
			flag = 1
			break
		if ans[i][1] - r < 0:
			flag = 1
			break
		if ans[i][0] - q < ans[i][1] - r:
			flag = 1
			break
		else:
			q = ans[i][0]
			r = ans[i][1]
	if flag == 0:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	max1 = 0
	max2 = 0
	flag = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if p >= max1 and c >= max2 and (p - c >= max1 - max2):
			max1 = max(max1, p)
			max2 = max(max2, c)
		else:
			flag = 1
	print('NO' if flag else 'YES')


for _ in range(int(input())):
	n = int(input())
	clears = 0
	plays = 0
	ok = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if c > p:
			ok = False
		if c < clears or p < plays:
			ok = False
		if c > clears and p == plays:
			ok = False
		if c - clears > p - plays:
			ok = False
		plays = p
		clears = c
	if ok:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
t = int(stdin.readline().strip())
for casos in range(t):
	n = int(stdin.readline().strip())
	s = []
	for i in range(n):
		s.append(list(map(int, stdin.readline().strip().split())))
	flag = True
	for i in range(1, n):
		if s[i][0] < s[i - 1][0] or s[i][1] < s[i - 1][1] or s[i][0] - s[i - 1][0] < s[i][1] - s[i - 1][1]:
			flag = False
	for i in range(n):
		if s[i][0] < s[i][1]:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	(p, c) = (0, 0)
	ans = 'YES'
	for i in range(int(input())):
		(x, y) = map(int, input().split())
		if p > x or c > y or y > x or (x - p < y - c):
			ans = 'NO'
		else:
			(p, c) = (x, y)
	print(ans)


def Ainp():
	n = input()
	A = []
	for pp in range(int(n)):
		l = input()
		task = []
		for i in range(int(l)):
			(n, m) = list(map(int, input().split()))
			task.append([n, m])
		A.append(task)
	for t in A:
		ok = True
		for (i, pc) in enumerate(t):
			(p, c) = pc
			if p < c:
				print('NO')
				ok = False
				break
			if i:
				(prevp, prevc) = t[i - 1]
				if prevp > p or prevc > c or p - prevp < c - prevc:
					ok = False
					print('NO')
					break
		if ok:
			print('YES')
Ainp()


for _ in range(int(input())):
	n = int(input())
	arr = []
	for i in range(n):
		(p, c) = map(int, input().split())
		arr.append((p, c))
	(flag, plays, clears) = (0, 0, 0)
	for (i, j) in enumerate(arr):
		if i == 0:
			if j[1] > j[0]:
				flag = 1
				break
			else:
				(plays, clears) = (j[0], j[1])
		else:
			if j[0] < plays or j[1] < clears or j[1] > j[0] or (j[1] > clears and j[0] <= plays):
				flag = 1
				break
			elif j[0] >= plays and j[1] >= clears:
				if j[1] - clears > j[0] - plays:
					flag = 1
					break
			(plays, clears) = (j[0], j[1])
	if flag == 1:
		print('NO')
	else:
		print('YES')


q = int(input())
for k in range(q):
	arr = []
	sm = 0
	n = int(input())
	(p, c) = map(int, input().split())
	arr.append([p, c])
	ok = True
	if p < c:
		print('NO')
		ok = False
	for i in range(1, n):
		(a, b) = map(int, input().split())
		arr.append([a, b])
		if ok and (arr[i][0] < arr[i - 1][0] or arr[i][1] < arr[i - 1][1] or a < b or (arr[i - 1][0] - arr[i - 1][1] > arr[i][0] - arr[i][1])):
			print('NO')
			ok = False
	if ok:
		print('YES')


t = int(input())
for i in range(t):
	s = 'YES'
	l = []
	n = int(input())
	for i in range(0, n):
		l1 = []
		(a, b) = input().split()
		a = int(a)
		b = int(b)
		l1.append(a)
		l1.append(b)
		l.append(l1)
	for i in range(0, len(l)):
		if i == 0:
			if l[i][0] < l[i][1]:
				s = 'NO'
		elif l[i][0] < l[i - 1][0]:
			s = 'NO'
		elif l[i][1] < l[i - 1][1]:
			s = 'NO'
		elif l[i][0] == l[i - 1][0] and l[i][1] > l[i - 1][0]:
			s = 'NO'
		elif l[i][0] < l[i][1]:
			s = 'NO'
		elif l[i][0] - l[i - 1][0] < l[i][1] - l[i - 1][1]:
			s = 'NO'
	print(s)


def check_validity(list_tuples):
	curr_plays = 0
	curr_clears = 0
	for tup in list_tuples:
		delta_plays = tup[0] - curr_plays
		delta_clears = tup[1] - curr_clears
		if delta_plays < delta_clears:
			return False
		if delta_clears < 0 or delta_plays < 0:
			return False
		curr_plays += delta_plays
		curr_clears += delta_clears
	return True

def main():
	n_test_cases = int(input())
	for test_case in range(n_test_cases):
		n_moments = int(input())
		obs = []
		for moment in range(n_moments):
			tup = input()
			plays = int(tup.split(' ')[0])
			clears = int(tup.split(' ')[1])
			obs.append((plays, clears))
		if check_validity(obs):
			print('YES')
		else:
			print('NO')
main()


t = int(input())
while t:
	t += -1
	n = int(input())
	ch = 1
	m1 = -1
	m2 = -1
	d = -1
	for i in range(n):
		(x, y) = map(int, input().split())
		if x < y:
			ch = 0
		if x < m1:
			ch = 0
		if y < m2:
			ch = 0
		if d != -1:
			if x - y < d:
				ch = 0
		d = x - y
		m1 = x
		m2 = y
	if ch:
		print('YES')
	else:
		print('NO')


def kek():
	n = int(input())
	arr1 = []
	arr2 = []
	for i in range(n):
		(p, c) = [int(j) for j in input().split()]
		arr1.append(p)
		arr2.append(c)
	for i in range(n):
		if arr2[i] > arr1[i] or (i > 0 and arr1[i] < arr1[i - 1]) or (i > 0 and arr2[i] < arr2[i - 1]):
			print('NO')
			return
		if i > 0:
			r = arr2[i] - arr2[i - 1]
			if arr1[i] - arr1[i - 1] < r:
				print('NO')
				return
	print('YES')

def main():
	t = int(input())
	for i in range(t):
		kek()
main()


for _ in range(int(input())):
	g = int(input())
	game = []
	for i in range(g):
		(a, b) = map(int, input().split())
		game.append(a)
		game.append(b)
	play = game[::2]
	clear = game[1::2]
	flag = 0
	for i in range(1, g):
		if play[i] < play[i - 1] or clear[i] < clear[i - 1]:
			flag = 1
		if clear[i] - clear[i - 1] > play[i] - play[i - 1]:
			flag = 1
		if play[i] < clear[i]:
			flag = 1
	if play[0] < clear[0]:
		flag = 1
	if flag == 0:
		print('YES')
	elif flag == 1:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	p = []
	c = []
	for j in range(n):
		(a, b) = map(int, input().split())
		p.append(a)
		c.append(b)
	if c[0] > p[0]:
		print('NO')
		continue
	elif n == 1:
		print('YES')
	for j in range(1, n):
		if p[j] < p[j - 1] or c[j] < c[j - 1]:
			print('NO')
			break
		if c[j] > p[j]:
			print('NO')
			break
		if c[j] - c[j - 1] > p[j] - p[j - 1]:
			print('NO')
			break
		if j == n - 1:
			print('YES')


for t in range(int(input())):
	R = []
	G = []
	hu = 0
	hi = 0
	su = 0
	p = 0
	o = 0
	for _ in range(int(input())):
		(l, m) = map(int, input().split())
		R.append(l)
		G.append(m)
	for i in range(len(R)):
		if R[i] >= 0 and G[i] >= 0:
			if i != len(R) - 1:
				if R[i + 1] - R[i] < G[i + 1] - G[i]:
					su = su - 1
		if R[i] >= G[i] and G[i] >= hu and (R[i] >= hi):
			su = su + 1
			hu = G[i]
			hi = R[i]
			o = o + G[i]
			p = p + R[i]
		if i != len(R) - 1:
			if R[i + 1] == hi and G[i + 1] != hu:
				su = su - 1
	if su == len(R):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	(last_a, last_b) = (0, 0)
	flag = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		if last_a > a:
			flag = 1
		if last_b > b:
			flag = 1
		if a - last_a < b - last_b:
			flag = 1
		(last_a, last_b) = (a, b)
	if flag == 1:
		print('NO')
	else:
		print('YES')


def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))
res = []
for i in range(inp()):
	play = 0
	clear = 0
	q = True
	for n in range(inp()):
		(a, b) = inlt()
		if a < play or b < clear:
			q = False
		if a - play < b - clear:
			q = False
		(play, clear) = (a, b)
	res.append('NO' if not q else 'YES')
for r in res:
	print(r)


cases = int(input())
for case in range(cases):
	number_of_moments = int(input())
	(last_number_of_plays, last_number_of_clear) = (-1, -1)
	flag = False
	for moment in range(number_of_moments):
		(number_of_plays, number_of_clears) = [int(x) for x in input().split(' ')]
		if last_number_of_plays > number_of_plays or last_number_of_clear > number_of_clears or number_of_clears - last_number_of_clear > number_of_plays - last_number_of_plays:
			flag = True
		(last_number_of_plays, last_number_of_clear) = (number_of_plays, number_of_clears)
	if not flag:
		print('YES')
	else:
		print('NO')


class Node:

	def __init__(self, value=None, next=None):
		self.value = value
		self.next = next

class LinkedList:

	def __init__(self, head=None):
		self.headNode = head

def check_is_valid_pair(pair):
	if pair[0] < pair[1]:
		return False
	return True

def check_record(n, my_records_list):
	j = 0
	for record_pair in my_records_list:
		if check_is_valid_pair(record_pair) is False:
			print('NO')
			return None
		elif j > 0:
			delta_plays = my_records_list[j][0] - my_records_list[j - 1][0]
			delta_clears = my_records_list[j][1] - my_records_list[j - 1][1]
			if delta_plays < delta_clears or delta_clears < 0 or delta_plays < 0:
				print('NO')
				return None
		j += 1
	print('YES')
	return None
T = int(input())
my_records_list = []
for i in range(T):
	n = int(input())
	my_records_list.clear()
	for j in range(n):
		record_pair = tuple(map(int, input().split()))
		my_records_list.append(record_pair)
	check_record(n, my_records_list)


for _ in range(int(input())):
	k = int(input())
	a = 0
	b = 0
	flag = 0
	for i in range(k):
		(n, m) = map(int, input().split())
		l = n - a
		o = m - b
		if l < 0 or o < 0 or l < o:
			flag = 1
		a = n
		b = m
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	data = [tuple(map(int, input().split(' '))) for _ in range(n)]
	is_correct = True
	for i in range(1, n):
		(p, c) = data[i - 1]
		(pp, cc) = data[i]
		is_correct = p <= pp and c <= cc and (cc - c <= pp - p) and (c <= p)
		if not is_correct:
			break
	(pp, cc) = data[-1]
	is_correct = is_correct and cc <= pp
	print('YES' if is_correct else 'NO')


numTestCases = int(input())
cases = []
caseLengths = []
for i in range(numTestCases):
	caseLengths.append(int(input()))
	tempCases = []
	for j in range(caseLengths[i]):
		tempCases.append(list(map(int, input().split())))
	cases.append(tempCases)
for case in cases:
	isOkay = True
	isFirst = False
	if case[0][0] < case[0][1]:
		print('NO')
		isOkay = False
		isFirst = True
	if not isFirst:
		for i in range(1, len(case)):
			tempCase = case[i]
			tempCaseBack = case[i - 1]
			if tempCase[0] < tempCaseBack[0]:
				print('NO')
				isOkay = False
				break
			elif tempCase[1] < tempCaseBack[1]:
				print('NO')
				isOkay = False
				break
			elif tempCase[0] < tempCase[1]:
				print('NO')
				isOkay = False
				break
			elif tempCase[1] - tempCaseBack[1] > tempCase[0] - tempCaseBack[0]:
				print('NO')
				isOkay = False
				break
	if isOkay:
		print('YES')


for _ in range(int(input())):
	p1 = 0
	c1 = 0
	flag = True
	for _ in range(int(input())):
		(p2, c2) = map(int, input().split())
		if not flag:
			continue
		if p2 < p1 or c2 < c1:
			flag = False
		if p2 - p1 < c2 - c1:
			flag = False
		p1 = p2
		c1 = c2
	if flag:
		print('YES')
	else:
		print('NO')


import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
t = int(input())
for _ in range(t):
	n = int(input())
	prep = 0
	prec = 0
	p = 0
	c = 0
	f = True
	for _ in range(n):
		(p, c) = [int(x) for x in input().split()]
		if c > p or p < prep or c < prec or (p - c < prep - prec):
			f = False
		prep = p
		prec = c
	if f:
		print('YES')
	else:
		print('NO')


T = int(input())
results = []
for i in range(T):
	N = int(input())
	stats = []
	for j in range(N):
		(p, c) = map(int, input().split(' '))
		stats.append([p, c])
	lastP = stats[0][0]
	lastC = stats[0][1]
	quit = False
	if lastP >= lastC:
		for stat in range(1, N):
			P = stats[stat][0]
			C = stats[stat][1]
			if P < lastP or C < lastC:
				print('NO')
				quit = True
				break
			elif C > P:
				print('NO')
				quit = True
				break
			elif C - lastC > P - lastP:
				print('NO')
				quit = True
				break
			lastP = P
			lastC = C
		if not quit:
			print('YES')
	else:
		print('NO')


t = int(input())
for z in range(t):
	n = int(input())
	lastp = 0
	lastc = 0
	flag = 'YES'
	for i in range(n):
		(play, clear) = map(int, input().split())
		if clear > play:
			flag = 'NO'
		if play < lastp or clear < lastc:
			flag = 'NO'
		if abs(lastc - clear) > abs(lastp - play):
			flag = 'NO'
		lastp = play
		lastc = clear
	print(flag)


for i in range(int(input())):
	n = int(input())
	k = []
	z = []
	count = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		if len(z) == 0 and len(k) == 0 or (a >= z[-1] and b >= k[-1] and (a - z[-1] >= b - k[-1])):
			if a >= b:
				z.append(a)
				k.append(b)
			else:
				count += 1
		else:
			count += 1
	if count == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for tt in range(t):
	n = int(input())
	P = [0] * n
	C = [0] * n
	for i in range(n):
		(P[i], C[i]) = [int(x) for x in input().split(' ')]
	if P == sorted(P) and C == sorted(C):
		if P[0] >= C[0]:
			bhul = True
			for i in range(1, n):
				if P[i] - P[i - 1] < C[i] - C[i - 1]:
					bhul = False
					break
			if bhul:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	flag = 0
	parr = []
	carr = []
	for i in range(n):
		(p, c) = map(int, input().split())
		parr.append(p)
		carr.append(c)
	for i in range(n):
		if parr[i] < carr[i]:
			flag = 1
			break
	if flag == 0:
		for i in range(1, n):
			if parr[i] < parr[i - 1]:
				flag = 1
				break
			if carr[i] < carr[i - 1]:
				flag = 1
				break
			if carr[i] - carr[i - 1] > parr[i] - parr[i - 1]:
				flag = 1
				break
	print('YES' if flag == 0 else 'NO')


for t in range(int(input())):
	valid = True
	parr = []
	carr = []
	for i in range(int(input())):
		(p, c) = input().split()
		p = int(p)
		c = int(c)
		parr.append(p)
		carr.append(c)
		if c > p or (i > 0 and ((p < parr[i - 1] or c < carr[i - 1]) or p - parr[i - 1] < c - carr[i - 1])):
			valid = False
	if valid:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t -= 1
	plays_aux = 0
	clears_aux = 0
	saida = True
	olhadas = int(input())
	for p in range(olhadas):
		entrada = input().split(' ')
		plays = int(entrada[0])
		clears = int(entrada[1])
		if plays < plays_aux:
			saida = False
		if clears < clears_aux:
			saida = False
		if plays - plays_aux < clears - clears_aux:
			saida = False
		plays_aux = plays
		clears_aux = clears
	if saida:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	(plast, clast) = (0, 0)
	ans = True
	for j in range(n):
		(p, c) = (int(_) for _ in input().split())
		(dp, dc, plast, clast) = (p - plast, c - clast, p, c)
		ans = ans and dc <= dp and (dp >= 0) and (dc >= 0)
	print('YES' if ans else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	b = []
	for j in range(n):
		(p, q) = map(int, input().split())
		a.append(p)
		b.append(q)
	f = 0
	for j in range(n - 1):
		if a[j] < b[j]:
			f = 1
			break
		if a[j + 1] < a[j]:
			f = 1
			break
		if b[j + 1] < b[j]:
			f = 1
			break
		if a[j + 1] - a[j] < b[j + 1] - b[j]:
			f = 1
			break
	if a[-1] < b[-1]:
		f = 1
	if f == 1:
		print('NO')
	else:
		print('YES')


def solve(n, stats):
	p = 0
	c = 0
	for stat in stats:
		if stat[0] < p or stat[1] < c or stat[1] - c > stat[0] - p:
			return False
		p = stat[0]
		c = stat[1]
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	stats = []
	for i in range(n):
		current_stat = list(map(int, input().split()))
		stats.append(current_stat)
	if solve(n, stats):
		print('YES')
	else:
		print('NO')


f = int(input())
for q in range(f):
	n = int(input())
	A = 0
	B = 0
	k = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		if a - A < b - B or a < A or b < B:
			k = 1
		A = a
		B = b
	if k == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	c = 0
	for j in range(n):
		arr.append(list(map(int, input().split())))
	if arr[0][0] < arr[0][1]:
		print('NO')
	else:
		for k in range(1, n):
			if arr[0][0] < arr[0][1]:
				print('NO')
				break
			elif arr[k][0] < arr[k - 1][0] or arr[k][0] < arr[k][1] or arr[k][1] < arr[k - 1][1]:
				print('NO')
				break
			elif arr[k][0] == arr[k - 1][0] and arr[k][1] != arr[k - 1][1]:
				print('NO')
				break
			elif abs(arr[k - 1][0] - arr[k][0]) < abs(arr[k - 1][1] - arr[k][1]):
				print('NO')
				break
			else:
				c += 1
				continue
		if c == n - 1:
			print('YES')


t = int(input())
for t1 in range(t):
	n = int(input())
	resposta = 'YES'
	(number_plays, number_clears) = [int(c) for c in input().split()]
	if number_clears > number_plays:
		resposta = 'NO'
	for n1 in range(n - 1):
		(new_number_plays, new_number_clears) = [int(c) for c in input().split()]
		if new_number_plays < number_plays:
			resposta = 'NO'
		elif new_number_clears < number_clears:
			resposta = 'NO'
		diff_number_plays = new_number_plays - number_plays
		diff_number_clears = new_number_clears - number_clears
		if diff_number_clears > diff_number_plays:
			resposta = 'NO'
		number_plays = new_number_plays
		number_clears = new_number_clears
	print(resposta)


t = int(input())
for _ in range(t):
	n = int(input())
	prev_p = 0
	prev_c = 0
	invalid = False
	for _ in range(n):
		(p, c) = map(int, input().split())
		if p < prev_p or c < prev_c or c > p or (p - prev_p < c - prev_c):
			invalid = True
		prev_p = p
		prev_c = c
	if invalid:
		print('NO')
	else:
		print('YES')


def cast(cre, typ):
	return type(typ)(map(cre, typ))

def solution():
	for t in range(int(input())):
		n = int(input())
		prev = [0, 0]
		while n > 0:
			n -= 1
			cur = cast(int, input().split())
			if prev[0] > cur[0] or prev[1] > cur[1] or cur[0] < cur[1] or (cur[0] - prev[0] < cur[1] - prev[1]):
				print('NO')
				break
			if n == 0:
				print('YES')
			prev = cur
		while n > 0:
			n -= 1
			input()
solution()


def solve():
	n = int(input())
	p_current = -1
	c_current = -1
	ans = 'YES'
	for i in range(n):
		(p, c) = [int(x) for x in input().split(' ')]
		p_dif = p - p_current
		c_dif = c - c_current
		if p >= c and p >= p_current and (c >= c_current) and (p_dif >= c_dif):
			p_current = p
			c_current = c
		else:
			ans = 'NO'
	print(ans)
t = int(input())
for i in range(t):
	solve()


from sys import stdin
a = int(stdin.readline())
for b in range(0, a):
	c = int(stdin.readline())
	d = stdin.readline().split()
	C = int(d[0])
	D = int(d[1])
	if c == 1:
		if C >= D:
			print('YES')
			continue
		else:
			print('NO')
			continue
	K = 0
	for e in range(1, c):
		d = stdin.readline().split()
		A = C
		B = D
		C = int(d[0])
		D = int(d[1])
		if (C >= A and D >= B) and (C >= D and (C - A >= D - B and A >= B)):
			continue
		else:
			print('NO')
			for g in range(e + 1, c):
				stdin.readline()
			K = 1
			break
	if K == 0:
		print('YES')


from collections import Counter as C, defaultdict as D, deque as Q
from operator import itemgetter as I
from itertools import product as P
from bisect import bisect_left as BL, bisect_right as BR
from heapq import heappush as HPUSH, heappop as HPOP
from math import floor as MF, ceil as MC, gcd as MG, factorial as F, sqrt as SQRT, inf as INFINITY, log as LOG
from sys import stdin, stdout
INPUT = stdin.readline
PRINT = stdout.write

def player1():
	print('')

def player2():
	print('')

def isPrime(n):
	for i in range(2, MC(SQRT(n)) + 1):
		if n % i == 0:
			return False
	return True

def factors(x):
	ans = []
	for i in range(1, MC(SQRT(x)) + 1):
		if x % i == 0:
			ans.append(i)
			if x % (x // i) == 0:
				ans.append(x // i)
	return ans

def main():
	for _ in range(int(INPUT())):
		n = int(INPUT())
		ans = 'YES'
		empty = 1
		for i in range(n):
			if empty:
				(pp, cc) = map(int, INPUT().split())
				empty = 0
				if cc > pp:
					ans = 'NO'
			else:
				(x, y) = map(int, INPUT().split())
				if x < pp or y < cc or y > x:
					ans = 'NO'
				elif y - cc > x - pp:
					ans = 'NO'
				pp = x
				cc = y
		PRINT(ans + '\n')
main()


for i in range(int(input())):
	old_plays = 0
	old_clears = 0
	answer = ''
	peeks = int(input())
	for j in range(peeks):
		(plays, clears) = map(int, input().split())
		if plays < old_plays or clears < old_clears or clears - old_clears > plays - old_plays:
			answer = 'NO'
		old_clears = clears
		old_plays = plays
	if answer == '':
		answer = 'YES'
	print(answer)


test = int(input())
while test:
	n = int(input())
	p_c = []
	t = False
	while n:
		data = list(map(int, input().split()))
		p_c.append(data)
		n -= 1
	if p_c[0][0] < p_c[0][1]:
		t = True
	else:
		i = 0
		while not t and i < len(p_c) - 1:
			if p_c[i + 1][1] < p_c[i][1] or p_c[i + 1][0] < p_c[i][0] or p_c[i + 1][1] - p_c[i][1] > p_c[i + 1][0] - p_c[i][0]:
				t = True
			i += 1
	if t:
		print('NO')
	else:
		print('YES')
	test -= 1


for _ in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	flag = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < a or c < b or p < c or (p - a < c - b):
			flag = 1
		a = p
		b = c
	if flag == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	(last1, last2) = (0, 0)
	tmp = 1
	for i in range(n):
		(new1, new2) = map(int, input().split())
		if new1 - last1 < new2 - last2 or new2 < last2 or new1 < last1:
			if tmp is 1:
				tmp = 0
		else:
			last1 = new1
			last2 = new2
	if tmp is 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ans = 'YES'
	cur_c = 0
	cur_p = 0
	for i in range(n):
		(p, c) = (int(x) for x in input().split())
		if c - cur_c > p - cur_p:
			ans = 'NO'
		if p < cur_p or c < cur_c:
			ans = 'NO'
		cur_p = p
		cur_c = c
	print(ans)


test_cases = int(input())
for case in range(test_cases):
	peeks = int(input())
	plays = []
	clears = []
	prev_play = 0
	prev_clear = 0
	flag = True
	for peek in range(peeks):
		(play, clear) = [int(s) for s in input().split()]
		play_del = abs(prev_play - play)
		clear_del = abs(prev_clear - clear)
		if not (play >= prev_play and clear >= prev_clear and (clear <= play)):
			flag = False
		elif play_del < clear_del:
			flag = False
		prev_play = play
		prev_clear = clear
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	p = int(input())
	l = []
	for i in range(p):
		(a, b) = [int(x) for x in input().split()]
		l.append((a, b))
	flag = 0
	for i in range(len(l)):
		if l[i][0] < l[i][1]:
			flag = 1
			break
		if i != 0 and (l[i][0] < l[i - 1][0] or l[i][1] < l[i - 1][1]):
			flag = 1
			break
		if i != 0 and l[i][0] - l[i - 1][0] < l[i][1] - l[i - 1][1]:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	pf = 0
	cf = 0
	flag = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if pf <= p and cf <= c:
			temp1 = p - pf
			temp2 = c - cf
			if temp1 >= temp2:
				pass
			else:
				flag = 1
			pf = p
			cf = c
		else:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	p_prev = 0
	c_prev = 0
	flag = True
	n = int(input())
	for _ in range(n):
		(p, c) = list(map(int, input().split()))
		if p < p_prev or c < c_prev or c > p:
			flag = False
		if p == p_prev and c > c_prev:
			flag = False
		if p - p_prev < c - c_prev:
			flag = False
		p_prev = p
		c_prev = c
	if flag:
		print('Yes')
	else:
		print('No')


from collections import Counter
import string
import math
import sys

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(number_of_variables):
	if number_of_variables == 1:
		return int(sys.stdin.readline())
	if number_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
mod = 100000007
for _ in range(vary(1)):
	plays = []
	clears = []
	for i in range(vary(1)):
		(p, c) = vary(2)
		plays.append(p)
		clears.append(c)
	sump = clearp = 0
	for i in range(len(plays)):
		if plays[i] < clears[i]:
			print('NO')
			break
		try:
			if plays[i] > plays[i + 1] or clears[i] > clears[i + 1]:
				print('NO')
				break
			t = plays[i + 1] - plays[i]
			if clears[i + 1] - clears[i] > t:
				print('NO')
				break
		except:
			pass
	else:
		print('YES')


for tc in range(int(input())):
	n = int(input())
	P = [0] * n
	C = [0] * n
	for i in range(n):
		(P[i], C[i]) = input().split(' ')
		(P[i], C[i]) = (int(P[i]), int(C[i]))
	ind = True
	if P[0] < C[0]:
		ind = False
	for i in range(n - 1):
		if P[i + 1] < P[i] or C[i + 1] < C[i] or P[i + 1] - P[i] < C[i + 1] - C[i]:
			ind = False
	if ind:
		print('YES')
	else:
		print('NO')


import collections
t = int(input())
for q in range(0, t):
	n = int(input())
	a = []
	for i in range(0, n):
		(x, y) = map(int, input().split())
		a.append([x, y])
	flag = 'YES'
	for i in range(0, n):
		if a[i][1] > a[i][0]:
			flag = 'NO'
			break
		elif i > 0:
			if a[i][1] < a[i - 1][1] or a[i][0] < a[i - 1][0] or a[i][1] - a[i - 1][1] > a[i][0] - a[i - 1][0]:
				flag = 'NO'
				break
	print(flag)


import sys
from math import gcd
from collections import defaultdict
from copy import copy
R = lambda t=int: t(input())
RL = lambda t=int: [t(x) for x in input().split()]
RLL = lambda n, t=int: [RL(t) for _ in range(n)]

def solve():
	n = R()
	S = RLL(n)
	lp = lc = 0
	for (p, c) in S:
		if lp > p or lc > c or c - lc > p - lp:
			print('NO')
			return
		lp = p
		lc = c
	print('YES')
T = R()
for _ in range(T):
	solve()


from collections import defaultdict
for _ in range(int(input())):
	N = int(input())
	Pairs = []
	for i in range(N):
		Pairs.append(list(map(int, input().split())))
	FLAG = 0
	for i in range(N):
		for j in range(i + 1, N):
			if Pairs[j][0] < Pairs[i][0] or Pairs[j][1] < Pairs[i][1]:
				FLAG = 1
				break
		if FLAG == 1:
			break
	if FLAG == 1:
		print('NO')
	else:
		Pairs.insert(0, [0, 0])
		N = len(Pairs)
		for i in range(N - 1):
			if Pairs[i + 1][0] - Pairs[i][0] < Pairs[i + 1][1] - Pairs[i][1]:
				FLAG = 1
				break
		if FLAG == 1:
			print('NO')
		else:
			print('YES')


n = int(input())
for y in range(n):
	k = int(input())
	lasa = 0
	lasb = 0
	couta = 0
	counb = 0
	flag = False
	for i in range(k):
		(a, b) = map(int, input().split())
		if lasa > a or lasb > b or (lasa == a and lasb != b) or (b > a) or (b - lasb > a - lasa):
			flag = True
		lasa = a
		lasb = b
		couta += a
		counb += b
	if couta >= counb and (not flag):
		print('YES')
	else:
		print('NO')


def solve(stats):
	plays = 0
	clears = 0
	for (i, stat) in enumerate(stats):
		plays += stat[0]
		clears += stat[1]
		if i > 0:
			if stats[i][0] < stats[i - 1][0]:
				return False
			if stats[i][1] < stats[i - 1][1]:
				return False
			new_plays = stats[i][0] - stats[i - 1][0]
			new_clears = stats[i][1] - stats[i - 1][1]
			if new_plays < new_clears:
				return False
		if plays < clears:
			return False
	return True
for i in range(int(input())):
	stats = [[int(x) for x in input().split()] for x in range(int(input()))]
	print('YES' if solve(stats) else 'NO')


def query(n, PC):
	p_prev = 0
	c_prev = 0
	for (p, c) in PC:
		play = p - p_prev
		clear = c - c_prev
		if play < 0 or clear < 0:
			return 'NO'
		if play < clear:
			return 'NO'
		p_prev = p
		c_prev = c
	return 'YES'

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		PC = [tuple(map(int, input().split())) for _ in range(n)]
		print(query(n, PC))
main()


for _ in range(int(input())):
	n = int(input())
	(plast, clast) = (0, 0)
	ans = True
	for i in range(n):
		(p, c) = map(int, input().split())
		(ap, ac, plast, clast) = (p - plast, c - clast, p, c)
		ans = ans and ap >= ac and (ac >= 0) and (ap >= 0)
	print('YES' if ans else 'NO')


T = int(input())
for t in range(T):
	n = int(input())
	(p, c) = (0, 0)
	exist = True
	for i in range(n):
		(p_new, c_new) = map(int, input().split())
		exist &= (p_new >= p) & (c_new >= c) & (p_new - c_new >= p - c)
		(p, c) = (p_new, c_new)
	print('YES' if exist else 'NO')


for _ in range(int(input())):
	ans = 'YES'
	(px, cx) = (-1, -1)
	for i in range(int(input())):
		(p, c) = map(int, input().split())
		if ans == 'N0':
			contine
		if i == 0 and c <= p:
			(px, cx) = (p, c)
		elif px <= p and cx <= c and (p >= c) and (p - px >= c - cx):
			(px, cx) = (p, c)
		else:
			ans = 'NO'
	print(ans)


import os
import sys
from math import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def array():
	return [int(i) for i in input().split()]
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	lp = -1
	lc = -1
	f = 1
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < lp or c < lc or c > p:
			f = 0
		if p - lp < c - lc:
			f = 0
		(lp, lc) = (p, c)
	if f == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	a = []
	for i in range(n):
		(p, c) = [int(x) for x in input().split()]
		a.append([p, c])
	flag = 0
	for i in range(1, n):
		if a[i][0] >= a[i - 1][0] and a[i][0] >= a[i][1] and (a[i - 1][0] >= a[i - 1][1]) and (a[i][1] >= a[i - 1][1]) and (a[i][1] - a[i - 1][1] <= a[i][0] - a[i - 1][0]):
			flag = 0
		else:
			flag = 1
			break
	if a[0][0] < a[0][1]:
		flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')
	t -= 1


t = int(input())
while t > 0:
	n = int(input())
	if n == 1:
		(p, c) = map(int, input().split())
		if p < c:
			print('NO')
		else:
			print('YES')
		t -= 1
	else:
		p = []
		c = []
		for i in range(n):
			(p1, c1) = map(int, input().split())
			p.append(p1)
			c.append(c1)
		p_curr = p[0]
		c_curr = c[0]
		if p_curr < c_curr:
			print('NO')
			t -= 1
			continue
		f = 0
		for i in range(1, n):
			if abs(p[i - 1] - p[i]) < abs(c[i - 1] - c[i]):
				print('NO')
				f = 1
				break
			if p[i - 1] > p[i]:
				print('NO')
				f = 1
				break
			if c[i - 1] > c[i]:
				print('NO')
				f = 1
				break
			if p[i] < c[i]:
				print('NO')
				f = 1
				break
		if f == 0:
			print('YES')
		t -= 1


t = int(input())
for test in range(t):
	flag = True
	n = int(input())
	(pr_p, pr_c) = map(int, input().split())
	if pr_c > pr_p:
		flag = False
	for i in range(n - 1):
		(p, c) = map(int, input().split())
		if p < pr_p or c < pr_c:
			flag = False
		if c - pr_c > p - pr_p:
			flag = False
		if c > p:
			flag = False
		(pr_p, pr_c) = (p, c)
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	x = []
	for j in range(n):
		(a, b) = input().strip().split(' ')
		(a, b) = [int(a), int(b)]
		x.append([a, b])
	ff = 1
	if x[0][0] < x[0][1]:
		ff = 0
	for j in range(n - 1):
		k = x[j + 1][0] - x[j][0]
		if k < 0:
			ff = 0
			break
		elif x[j + 1][1] - x[j][1] < 0:
			ff = 0
			break
		elif x[j + 1][1] - x[j][1] > k:
			ff = 0
			break
	if ff:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	last = [0, 0]
	output = 'YES'
	for i in range(n):
		(p, c) = map(int, input().split())
		if output == 'YES':
			if p < c:
				output = 'NO'
			if p < last[0]:
				output = 'NO'
			if c < last[1]:
				output = 'NO'
			if p - last[0] < c - last[1]:
				output = 'NO'
			last = [p, c]
	print(output)


ans = []
for kek in range(int(input())):
	n = int(input())
	P = -1
	C = -1
	flag = True
	for i in range(n):
		(p, c) = map(int, input().split())
		dp = p - P
		dc = c - C
		if dp >= dc and p >= c and (p >= P) and (c >= C):
			P = p
			C = c
		else:
			flag = False
	if flag:
		ans.append('Yes')
	else:
		ans.append('No')
print(*ans, sep='\n')


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		ans = True
		(p, c) = (0, 0)
		for _ in range(n):
			(np, nc) = list(map(int, input().split()))
			dp = np - p
			dc = nc - c
			if not (dp >= 0 and dc >= 0 and (dp >= dc)):
				ans = False
			(p, c) = (np, nc)
		print(ans and 'YES' or 'NO')
main()


def solve(n, rs):
	if len(rs) == 1:
		return rs[0][0] >= rs[0][1] and rs[0][0] >= 0 and (rs[0][1] >= 0)
	for (r1, r2) in zip(rs, rs[1:]):
		if r1[0] < 0 or r1[1] < 0 or r2[0] < 0 or (r2[1] < 0):
			return False
		diff_p = r2[0] - r1[0]
		diff_c = r2[1] - r1[1]
		if r1[0] < r1[1] or r2[0] < r2[1]:
			return False
		if diff_c < 0 or diff_p < 0:
			return False
		if diff_c > diff_p:
			return False
	return True
T = int(input())
for _ in range(T):
	n = int(input())
	records = []
	for _ in range(n):
		(p, c) = (int(i) for i in input().split())
		records.append((p, c))
	if solve(n, records):
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
input = stdin.readline
print = stdout.write
for _ in range(int(input())):
	n = int(input())
	ans = 'YES'
	(p1, c1) = map(int, input().split())
	for i in range(n - 1):
		(p, c) = map(int, input().split())
		if p < p1 or c < c1 or c - c1 > p - p1 or (c > p) or (c1 > p1):
			ans = 'NO'
		p1 = p
		c1 = c
	if n == 1 and c1 > p1:
		ans = 'NO'
	print(ans + '\n')


t = int(input())
for i in range(t):
	n = int(input())
	seq = []
	for j in range(n):
		(p, c) = list(map(int, input().strip().split(' ')))
		seq.append([p, c])
	im = True
	if n == 1 and seq[0][1] > seq[0][0]:
		print('NO')
		continue
	for j in range(1, n):
		prev = seq[j - 1]
		cur = seq[j]
		if prev[1] > cur[1] or prev[0] > cur[0]:
			im = False
			break
		elif prev[1] > prev[0] or cur[1] > cur[0]:
			im = False
			break
		elif cur[1] - cur[0] > prev[1] - prev[0]:
			im = False
			break
	print('YES' if im else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	play = 0
	clear = 0
	flg = 0
	for i in range(n):
		(a, b) = map(int, input().strip().split())
		if a >= play and b >= clear and (a - play >= b - clear):
			pass
		else:
			flg = 1
		play = a
		clear = b
	if flg:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	p = []
	c = []
	for j in range(n):
		p_c = list(map(int, input().split()))
		p.append(p_c[0])
		c.append(p_c[1])
	flag = 0
	if n > 1:
		for j in range(n - 1):
			if p[j + 1] - p[j] < c[j + 1] - c[j] or p[j] < c[j] or p[j + 1] < c[j + 1]:
				flag = 1
				break
			elif c[j + 1] - c[j] < 0:
				flag = 1
				break
	elif p[0] < c[0]:
		flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(lpi, lci) = (0, 0)
	ans = True
	for _ in range(int(input())):
		(pi, ci) = list(map(int, input().split()))
		if pi >= ci and pi - lpi >= ci - lci and (pi == lpi and ci == lci or (pi > lpi and ci >= lci)):
			ans &= True
		else:
			ans &= False
		(lpi, lci) = (pi, ci)
	print('YES' if ans else 'NO')


for k in range(int(input())):
	p = int(input())
	(g1, g2, h1, h2, t) = ([0], [0], [0], [0], True)
	for i in range(1, p + 1):
		(a, b) = [int(x) for x in input().split()]
		g1.append(a)
		h1.append(b)
		g2.append(g1[i] - g1[i - 1])
		h2.append(h1[i] - h1[i - 1])
	for i in range(p + 1):
		if g2[i] < h2[i] or g2[i] < 0 or h2[i] < 0:
			print('NO')
			t = False
			break
	if t == True:
		print('YES')


y = int(input())
for i in range(y):
	n = int(input())
	la = -2
	lb = -1
	q = True
	for i in range(n):
		(a, b) = map(int, input().split())
		if a - la >= b - lb and a - la >= 0 and (b - lb >= 0) and (a >= b):
			la = a
			lb = b
		else:
			q = False
	if q:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	pt = 0
	ct = 0
	b = True
	for j in range(n):
		(p, c) = map(int, input().split())
		if p < pt or c < ct or c > p or (p - c < pt - ct):
			b = False
		pt = p
		ct = c
	if b:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	l = []
	f = 0
	for i in range(0, n):
		l.append([int(j) for j in input().split()])
		i = 0
	if l[i][0] < l[i][1]:
		f = 1
	for i in range(n - 1):
		if l[i + 1][0] - l[i][0] < 0:
			f = 1
		if l[i][0] < l[i][1]:
			f = 1
		if l[i + 1][0] - l[i][0] < l[i + 1][1] - l[i][1]:
			f = 1
		if l[i + 1][1] - l[i][1] < 0:
			f = 1
	i = n - 1
	if l[i][0] < l[i][1]:
		f = 1
	if f == 0:
		print('YES')
	else:
		print('NO')
	t = t - 1


t = int(input())
for iter in range(t):
	n = int(input())
	p = c = 0
	flag = 0
	for _ in range(n):
		(p1, c1) = [int(x) for x in input().split()]
		if p1 < p or c1 < c or c1 - c > p1 - p:
			flag = 1
		p = p1
		c = c1
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
while t:
	t -= 1
	n = int(input())
	(lp, lc) = (-1, -1)
	correct = True
	while n:
		n -= 1
		(p, c) = list(map(int, input().split()))
		if p >= lp and c >= lc and (p >= c) and (c - lc <= p - lp):
			(lp, lc) = (p, c)
		else:
			correct = False
	if correct:
		print('YES')
	else:
		print('NO')


from math import *
from math import factorial as fact, comb as ncr
from bisect import bisect_left as bl
from bisect import bisect_right as br
from array import array
from collections import Counter as ctr
from collections import deque as dq
li = lambda : list(map(int, input().split()))
arr = lambda a: array('i', a)
bi = lambda n: bin(n).replace('0b', '')

def solve():
	for _ in range(int(input())):
		t = int(input())
		m = n = 0
		f = True
		for i in range(t):
			(a, b) = li()
			if f and (a - m < b - n or b < n or a < m):
				f = False
			elif not f:
				pass
			else:
				m = a
				n = b
		print('YES' if f else 'NO')
solve()


import sys

def isPossible(PC):
	(p, c) = (PC[0][0], PC[0][1])
	if c > p:
		print('NO')
		return
	for i in range(1, len(PC)):
		(p0, c0) = (PC[i - 1][0], PC[i - 1][1])
		(p1, c1) = (PC[i][0], PC[i][1])
		if c1 > p1:
			print('NO')
			return
		if p0 > p1:
			print('NO')
			return
		if c0 > c1:
			print('NO')
			return
		if c1 - c0 > p1 - p0:
			print('NO')
			return
	print('YES')
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def f(a, n):
	return True

def is_permutation(arr):
	for e in range(1, len(arr) + 1):
		if e not in arr:
			return False
	return True
t = inp()
for i in range(t):
	n = inp()
	PC = []
	for i in range(n):
		PC.append(inlt())
	isPossible(PC)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
for _ in range(ii()):
	n = ii()
	arr = []
	for i in range(n):
		arr.append(li())
	if n == 1:
		if arr[0][0] < arr[0][1]:
			print('NO')
		else:
			print('YES')
	else:
		for i in range(n - 1):
			if arr[0][0] < arr[0][1] or arr[i + 1][0] - arr[i][0] < 0 or arr[i + 1][1] - arr[i][1] < 0 or (arr[i + 1][0] - arr[i][0] < arr[i + 1][1] - arr[i][1]):
				print('NO')
				break
		else:
			print('YES')


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	n = int(input())
	p = [0] * n
	c = [0] * n
	for i in range(n):
		(p[i], c[i]) = map(int, input().split())
	ok = True
	if p[0] < c[0]:
		ok = False
	for i in range(n - 1):
		dp = p[i + 1] - p[i]
		dc = c[i + 1] - c[i]
		if dp < 0 or dc < 0 or dp < dc:
			ok = False
			break
	print('YES' if ok else 'NO')


import sys

def main():
	res = ''
	input = sys.stdin.readline
	print = sys.stdout.write
	t = int(input())
	for _ in range(t):
		sub_res = 'YES\n'
		n = int(input())
		pl = 0
		cl = 0
		for __ in range(n):
			(p, c) = map(int, input().split())
			if p < pl or c < cl or p - pl < c - cl:
				sub_res = 'NO\n'
			pl = p
			cl = c
		res += sub_res
	print(res)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	la = []
	lb = []
	c = 0
	for i in range(n):
		(x, y) = map(int, input().split())
		if y <= x:
			c = c + 1
		la.append(x)
		lb.append(y)
	val = 0
	for i in range(1, len(la)):
		if la[i] - lb[i] < la[i - 1] - lb[i - 1]:
			val = 1
			break
		if la[i] < la[i - 1]:
			val = 1
			break
	for i in range(1, len(lb)):
		if lb[i] < lb[i - 1]:
			val = 1
			break
	if c == n and val == 0:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	p = []
	c = []
	for i in range(n):
		(pi, ci) = map(int, input().split())
		p.append(pi)
		c.append(ci)
	if p[0] < c[0]:
		print('NO')
		continue
	check = 1
	for i in range(1, n):
		if not (p[i] >= p[i - 1] and c[i - 1] <= c[i] <= p[i] and (p[i] - p[i - 1] >= c[i] - c[i - 1])):
			check = 0
			break
	if check == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
r = []
for i in range(t):
	b = []
	d = []
	n = int(input())
	for j in range(n):
		a = list(map(int, input().split()))
		b.append(a[0])
		d.append(a[1])
	if b[0] < d[0]:
		r.append('NO')
	else:
		p = [x - b[i - 1] for (i, x) in enumerate(b) if i > 0]
		c = [x - d[i - 1] for (i, x) in enumerate(d) if i > 0]
		s1 = sum((1 for number in p if number < 0))
		s2 = sum((1 for number in c if number < 0))
		if s1 != 0 or s2 != 0:
			r.append('NO')
		else:
			q = 0
			for j in range(n - 1):
				if p[j] != c[j]:
					if p[j] < c[j]:
						q = q + 1
			if q != 0:
				r.append('NO')
			else:
				r.append('YES')
for i in range(len(r)):
	print(r[i])


t = int(input())
for i in range(t):
	n = int(input())
	inside = 0
	detect = 0
	p_prev = 0
	c_prev = 0
	for i in range(n):
		(play, clear) = [int(x) for x in input().split()]
		if play < p_prev or clear < c_prev:
			detect = 1
		elif play < clear:
			detect = 1
		elif play - p_prev < clear - c_prev:
			detect = 1
		inside += 1
		p_prev = play
		c_prev = clear
	if detect == 1:
		print('NO')
	elif inside == 1:
		if play >= clear:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	(pp, cc) = (0, 0)
	flag = 1
	for i in range(n):
		(p, c) = map(int, input().split())
		if not (p >= pp and c >= cc and (p - pp >= c - cc)):
			flag = 0
		else:
			pp = p
			cc = c
	if flag:
		print('YES')
	else:
		print('NO')


testCases = int(input())
for _ in range(testCases):
	answer = 'YES'
	answerNoted = True
	records = []
	n = int(input())
	for index in range(n):
		record = list(map(int, input().split()))
		if index == 0:
			if record[0] < record[1] and answerNoted:
				answer = 'NO'
				answerNoted = False
		elif record[0] < record[1] and answerNoted:
			answer = 'NO'
			answerNoted = False
		elif (records[-1][0] > record[0] or records[-1][1] > record[1]) and answerNoted:
			answer = 'NO'
			answerNoted = False
		elif records[-1][0] == record[0] and records[-1][1] < record[1] and answerNoted:
			answer = 'NO'
			answerNoted = False
		elif record[0] - records[-1][0] < record[1] - records[-1][1] and answerNoted:
			answer = 'NO'
			answerNoted = False
		records.append(record)
	print(answer)


import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
	n = ni()
	f = 0
	a = c = 0
	for _ in range(n):
		(na, nc) = nm()
		if a > na or c > nc or na - a < nc - c:
			f = 1
		(a, c) = (na, nc)
	print('NO' if f else 'YES')
	return
T = ni()
for _ in range(T):
	solve()


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l1 = list(map(int, input().split()))
		l.append(l1)
	i = 0
	f = 0
	while i < n - 1:
		if l[i][0] < l[i][1]:
			f = 1
			break
		elif l[i + 1][0] < l[i][0] or l[i + 1][1] < l[i][1]:
			f = 1
			break
		elif l[i + 1][0] - l[i][0] < l[i + 1][1] - l[i][1]:
			f = 1
			break
		i += 1
	if l[i][0] < l[i][1]:
		f = 1
	if f == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	(p0, c0) = (0, 0)
	res = True
	for i in range(100):
		h = p0 + c0
	for i in range(n):
		(p, c) = map(int, input().split())
		(ap, ac, p0, c0) = (p - p0, c - c0, p, c)
		res = res and ap >= ac and (ac >= 0) and (ap >= 0)
	print('YES' if res else 'NO')


import sys

def answer(n, p, c):
	num_p = p[0]
	num_c = c[0]
	if num_c > num_p:
		return 'NO'
	for i in range(1, n):
		num_p = p[i] - p[i - 1]
		num_c = c[i] - c[i - 1]
		if num_p < 0:
			return 'NO'
		if num_c < 0:
			return 'NO'
		if num_c > num_p:
			return 'NO'
	return 'YES'

def main():
	T = int(input())
	while T:
		n = int(input())
		p = [0] * n
		c = [0] * n
		for i in range(n):
			(p[i], c[i]) = [int(i) for i in sys.stdin.readline().split()]
		print(answer(n, p, c))
		T -= 1
	return
main()


from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from itertools import *
from random import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from re import *
from os import *

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
(graph, mod, szzz) = ({}, 10 ** 9 + 7, lambda : sorted(zzz()))

def getStr():
	return input()

def getInt():
	return int(input())

def listStr():
	return list(input())

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

def isInt(s):
	return '0' <= s[0] <= '9'

def input():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in input().split()]

def output(answer, end='\n'):
	stdout.write(str(answer) + end)

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
daysInMounth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
for tc in range(getInt()):
	n = getInt()
	(am, bm) = (0, 0)
	res = 'YES'
	for i in range(n):
		(a, b) = zzz()
		if a < am or b < bm or a - b < am - bm:
			res = 'NO'
		(am, bm) = (a, b)
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	nums = [list(map(int, input().split(' '))) for _ in range(n)]
	ans = 'YES'
	(p, c) = nums[0]
	before_c = c
	before_p = p
	if c > p:
		ans = 'NO'
	for num in nums[1:]:
		(p, c) = num
		challenges = p - before_p
		clear_diff = c - before_c
		if p < c or p < before_p or challenges < clear_diff or (c < before_c):
			ans = 'NO'
		before_c = c
		before_p = p
	print(ans)


case_id = 0
test_results = []
t = int(input())
for i in range(1, t + 1):
	n = int(input())
	test_cases = []
	for i in range(1, n + 1):
		test_case = [int(x) for x in input().split(' ')]
		test_cases.append(test_case)
	for case_id in range(n):
		if test_cases[case_id][0] < test_cases[case_id][1]:
			test_results.append('NO')
			break
		elif case_id + 1 != n:
			if test_cases[case_id][0] > test_cases[case_id + 1][0] or test_cases[case_id][1] > test_cases[case_id + 1][1]:
				test_results.append('NO')
				break
			elif test_cases[case_id][0] == test_cases[case_id + 1][0] and test_cases[case_id][1] != test_cases[case_id + 1][1]:
				test_results.append('NO')
				break
			elif test_cases[case_id + 1][1] - test_cases[case_id][1] > test_cases[case_id + 1][0] - test_cases[case_id][0]:
				test_results.append('NO')
				break
	else:
		test_results.append('YES')
for i in test_results:
	print(i)


for i in range(int(input())):
	n = int(input())
	(plays_old, clears_old) = list(map(int, input().split()))
	x = 0
	if plays_old < clears_old:
		x = 1
		for k in range(n - 1):
			input()
	else:
		for j in range(n - 1):
			(plays_new, clears_new) = list(map(int, input().split()))
			if clears_new - clears_old < 0 or plays_new - plays_old < clears_new - clears_old:
				x = 1
				for k in range(n - 2 - j):
					input()
				break
			plays_old = plays_new
			clears_old = clears_new
	if x == 1:
		print('NO')
	else:
		print('YES')


a = int(input())
for _ in range(a):
	b = int(input())
	(c, d, re) = (0, 0, True)
	for i in range(b):
		(x, y) = map(int, input().split())
		if x < y or c > x or d > y or (x - c < y - d):
			re = False
		c = x
		d = y
	print('YES' if re else 'NO')


def solve(stats, ans):
	(p, c) = (0, 0)
	for i in range(len(stats)):
		(curr_p, curr_c) = (stats[i][0], stats[i][1])
		if curr_c > curr_p:
			ans.append('NO')
			return
		if curr_p >= p:
			diff = curr_p - p
			if curr_c < c:
				ans.append('NO')
				return
			if curr_c - c > diff:
				ans.append('NO')
				return
		else:
			ans.append('NO')
			return
		(p, c) = (curr_p, curr_c)
	ans.append('YES')

def main():
	t = int(input())
	ans = []
	for i in range(t):
		n = int(input())
		stats = []
		for j in range(n):
			(p, c) = map(int, input().split())
			stats.append((p, c))
		solve(stats, ans)
	for i in ans:
		print(i)
main()


import sys
input = sys.stdin.readline
x = int(input())
for _ in range(x):
	t = int(input())
	ans = 'YES'
	lp = lc = 0
	for i in range(t):
		(p, c) = map(int, input().split())
		if p < lp or c < lc or p - lp < c - lc:
			ans = 'NO'
		(lp, lc) = (p, c)
	print(ans)


t = int(input())
for test in range(t):
	n = int(input())
	res = True
	pp = 0
	cc = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if p - c < pp - cc:
			res = False
		if p < pp:
			res = False
		if c > p:
			res = False
		if c < cc:
			res = False
		pp = p
		cc = c
	if res:
		print('yes')
	else:
		print('no')


t = int(input())
for _ in range(t):
	n = int(input())
	temp = []
	for i in range(n):
		(x, y) = list(map(int, input().split()))
		temp.append((x, y))
	ans = 1
	for j in range(n):
		if temp[j][0] < temp[j][1]:
			ans = 0
			break
		if j + 1 < n:
			if temp[j + 1][0] < temp[j][0] or temp[j + 1][1] < temp[j][1]:
				ans = 0
				break
			if temp[j + 1][1] - temp[j][1] > temp[j + 1][0] - temp[j][0]:
				ans = 0
				break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for q in range(0, t):
	n = int(input())
	(a, b) = map(int, input().split())
	if a >= b:
		e = 1
	else:
		e = 0
	c = a
	d = b
	for i in range(1, n):
		(a, b) = map(int, input().split())
		if d + (a - c) < b:
			e = 0
		elif a >= c and d <= b and (a >= b):
			e = e
		else:
			e = 0
		c = a
		d = b
	if e == 0:
		print('NO')
	else:
		print('YES')


T = int(input())
while T:
	valid = True
	n = int(input())
	(games, clears) = (0, 0)
	for _ in range(n):
		(a, b) = map(int, input().split())
		(d1, d2) = (a - games, b - clears)
		if a < b or a < games or b < clears or (d1 < d2):
			valid = False
		(games, clears) = (a, b)
	print('YES' if valid else 'NO')
	T -= 1


import sys
input = sys.stdin.readline
t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	pc = []
	f = True
	pre_c = 0
	pre_p = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if pre_p > p or pre_c > c or c > p:
			f = False
		if p - pre_p < c - pre_c:
			f = False
		pre_p = p
		pre_c = c
	if f:
		ans.append('YES')
	else:
		ans.append('NO')
print('\n'.join(ans))


t = int(input())
for t_itr in range(0, t):
	n = int(input())
	plays = [-1] * n
	clears = [-1] * n
	pmax = float('-inf')
	cmax = float('-inf')
	flag = 1
	(plays[0], clears[0]) = map(int, input().split())
	if clears[0] > plays[0]:
		flag = 0
	for i in range(1, n):
		(plays[i], clears[i]) = map(int, input().split())
		if plays[i] > pmax:
			pmax = plays[i]
		if clears[i] > cmax:
			cmax = clears[i]
		if plays[i] < plays[i - 1] or clears[i] < clears[i - 1] or clears[i] > pmax or (clears[i] - clears[i - 1] > plays[i] - plays[i - 1]):
			flag = 0
	print('YES' if flag == 1 else 'NO')


for i in range(int(input())):
	p = c = 0
	c1 = True
	for i in range(int(input())):
		(m, n) = map(int, input().split())
		if m < p or n < c or n - c > m - p:
			c1 = False
		p = m
		c = n
	if c1:
		print('YES')
	else:
		print('NO')


t = int(input())

def fun(n, a):
	p = a[0][0]
	c = a[0][1]
	if c <= p:
		flag = 0
		for i in range(1, n):
			if p <= a[i][0] and c <= a[i][1] and (a[i][0] - p >= a[i][1] - c):
				p = a[i][0]
				c = a[i][1]
			else:
				flag += 1
				break
		if flag:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')
while t:
	t -= 1
	n = int(input())
	a = []
	for i in range(n):
		(p, q) = map(int, input().split())
		a.append((p, q))
	fun(n, a)


for _ in range(int(input())):
	n = int(input())
	diff = 0
	c = 1
	initial_l0 = 0
	initial_l1 = 0
	for i in range(n):
		l = [int(x) for x in input().split()]
		if c == 1:
			if l[0] < l[1]:
				c = 0
			if l[0] - l[1] < diff:
				c = 0
			if l[0] < initial_l0:
				c = 0
			if l[1] < initial_l1:
				c = 0
			initial_l1 = l[1]
			initial_l0 = l[0]
		diff = l[0] - l[1]
	if c == 0:
		print('NO')
	else:
		print('YES')


T = int(input())
for i in range(T):
	p = []
	c = []
	count = 0
	mini = 0
	n = int(input())
	for j in range(n):
		(pk, ck) = [int(x) for x in input().split()]
		if pk >= ck and pk - ck >= mini:
			count += 1
			mini = pk - ck
		p.append(pk)
		c.append(ck)
	psor = sorted(p)
	csor = sorted(c)
	if p == psor and c == csor and (count == n):
		print('YES')
	else:
		print('NO')


test = int(input())
for t in range(test):
	n = int(input())
	a = 0
	b = 0
	fl = True
	for _ in range(n):
		(x, y) = input().split()
		x = int(x)
		y = int(y)
		if x < a or y < b or y - b > x - a:
			fl = False
		a = x
		b = y
	if fl:
		print('Yes')
	else:
		print('No')


def solution():
	t = int(input())
	for _ in range(t):
		n = int(input())
		p = []
		c = []
		for _ in range(n):
			(pi, ci) = map(int, input().split())
			p.append(pi)
			c.append(ci)
		if p[0] < c[0]:
			print('NO')
			continue
		was_error = False
		for i in range(1, n):
			if p[i] < p[i - 1] or c[i] < c[i - 1]:
				was_error = True
				print('NO')
				break
			if p[i] == p[i - 1]:
				if not c[i] == c[i]:
					was_error = True
					print('NO')
					break
			if p[i] - p[i - 1] < c[i] - c[i - 1]:
				was_error = True
				print('NO')
				break
		if not was_error:
			print('YES')
solution()


from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))

def chars():
	s = cin()
	return list(s[:len(s) - 1])

def pl(a):
	for val in a:
		cout(str(val) + ' ')
	cout('\n')
(t,) = mp()
for _ in range(t):
	(n,) = mp()
	p = c = 0
	f = 0
	for i in range(n):
		(x, y) = mp()
		if x - p >= 0 and 0 <= y - c <= x - p:
			p = x
			c = y
		else:
			f = 1
	if f:
		cout('no\n')
	else:
		cout('yes\n')


t = int(input())
for _ in range(t):
	n = int(input())
	pm = -1
	cm = -1
	ans = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if c - cm > p - pm:
			ans = False
		if pm > p:
			ans = False
		pm = p
		if cm > c:
			ans = False
		cm = c
	if ans:
		print('YES')
	else:
		print('NO')


import sys
input = iter(sys.stdin.readlines()).__next__
import collections
T = int(input())
for _ in range(T):
	n = int(input())
	Obs = collections.namedtuple('Obs', 'p c')
	obs = [Obs(*map(int, input().split())) for _ in range(n)]

	def ok():
		for i in range(n):
			if obs[i].c > obs[i].p:
				return False
			if i == 0:
				continue
			plays = obs[i].p - obs[i - 1].p
			if plays < 0:
				return False
			clears = obs[i].c - obs[i - 1].c
			if clears < 0 or clears > plays:
				return False
		else:
			return True
	print('YES' if ok() else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	m1 = 0
	m2 = 0
	dif = 0
	boo = True
	for j in range(n):
		(p, c) = map(int, input().split())
		if p < m1 or c < m2 or p - c < dif:
			boo = False
		elif c > p:
			boo = False
		if p > m1:
			m1 = p
		if c > m2:
			m2 = c
		dif = p - c
	print('YES' if boo else 'NO')


kl = int(input())
for l in range(kl):
	(no, mo, pr) = (0, 0, 1)
	n = int(input())
	for i in range(n):
		(n, m) = map(int, input().split())
		if n >= no and m >= mo and (n - no >= m - mo):
			(no, mo) = (n, m)
		else:
			pr = 0
	if pr:
		print('YES')
	else:
		print('NO')


test_cases = int(input())

def handle() -> str:
	lines = int(input())
	passes = clears = 0
	error_occurred = False
	for _ in range(lines):
		(p, c) = input().split(' ')
		p = int(p)
		c = int(c)
		if c > p:
			error_occurred = True
		pass_diff = p - passes
		clear_diff = c - clears
		if clear_diff > pass_diff:
			error_occurred = True
		if pass_diff < 0 or clear_diff < 0:
			error_occurred = True
		passes += pass_diff
		clears += clear_diff
	if error_occurred:
		return 'NO'
	return 'YES'
for _ in range(test_cases):
	print(handle())


t = int(input())
for _ in range(t):
	n = int(input())
	flag = True
	(pi, ci) = (0, 0)
	for _ in range(n):
		(pv, cv) = map(int, input().split())
		if flag:
			if pv - pi < cv - ci or pv < pi or cv < ci:
				flag = False
			(pi, ci) = (pv, cv)
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	(lp, lc) = (0, 0)
	ans = 'YES'
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < lp or c < lc or p - lp < c - lc:
			ans = 'NO'
		(lp, lc) = (p, c)
	print(ans)


I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	f = 1
	for i in range(n):
		(x, y) = I()
		if x < a or y < b or y - b > x - a:
			f = 0
		a = x
		b = y
	print('YES' if f else 'NO')


for _ in range(int(input())):
	n = int(input())
	p = 0
	c = 0
	ans = 1
	for i in range(n):
		(P, C) = map(int, input().split())
		if p == P and c == C:
			continue
		if p < P and c <= C <= c + P - p:
			p = P
			c = C
			continue
		ans = 0
	if ans:
		print('YES')
	else:
		print('NO')


tc = int(input())
while tc > 0:
	n = int(input())
	last_p = 0
	last_c = 0
	ans = True
	while n > 0:
		n -= 1
		(p, c) = map(int, input().split())
		if p < last_p or c < last_c:
			ans = False
			break
		delta_p = p - last_p
		delta_c = c - last_c
		if delta_c > delta_p:
			ans = False
			break
		last_p = p
		last_c = c
	for _ in range(n):
		_ = input()
	if ans:
		print('YES')
	else:
		print('NO')
	tc -= 1


t = int(input())
for _ in range(t):
	f = True
	n = int(input())
	a = [[-1, -1]]
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < c or p - a[-1][0] < c - a[-1][1] or p < a[-1][0] or (c < a[-1][1]):
			f = False
		a.append([p, c])
	print('YES' if f else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	T = [None] * n
	for i in range(n):
		T[i] = list(map(int, input().split()))
	if T[0][1] > T[0][0]:
		print('NO')
	else:
		for i in range(1, n):
			if T[i - 1][0] > T[i][0] or T[i - 1][1] > T[i][1]:
				print('NO')
				break
			elif T[i][1] - T[i - 1][1] > T[i][0] - T[i - 1][0]:
				print('NO')
				break
		else:
			print('YES')


rint = lambda : int(input())
rounds = rint()
for _ in range(rounds):
	data = [[int(c) for c in input().split()] for __ in range(rint())]
	time_seq = all([data[i][0] <= data[i + 1][0] and data[i][1] <= data[i + 1][1] and (data[i + 1][0] - data[i][0] >= data[i + 1][1] - data[i][1]) for i in range(len(data) - 1)])
	succ_prop = all([data[i][0] >= data[i][1] for i in range(len(data))])
	if time_seq and succ_prop:
		print('YES')
	else:
		print('NO')


def solve(p, c):
	n = len(p)
	if p[0] < c[0]:
		return 'NO'
	for i in range(1, n):
		if p[i - 1] > p[i] or c[i - 1] > c[i] or p[i] < c[i] or (p[i] - p[i - 1] < c[i] - c[i - 1]):
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	p = []
	c = []
	for _ in range(n):
		(x, y) = map(int, input().split())
		p.append(x)
		c.append(y)
	print(solve(p, c))


from sys import stdin, stdout
q = int(input())
for k in range(q):
	n = int(input())
	l = []
	for i in range(n):
		d = list(map(int, stdin.readline().split()))
		l.append(d)
	flag = 0
	for i in range(n):
		if i == 0:
			if l[i][1] > l[i][0]:
				flag = 1
				break
		else:
			d = l[i][1] - l[i - 1][1]
			if l[i][0] - l[i - 1][0] < d:
				flag = 1
				break
			if l[i][0] >= l[i][1] and l[i][0] >= l[i - 1][0] and (l[i][1] >= l[i - 1][1]):
				flag = 0
			else:
				flag = 1
				break
	if flag == 1:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	m = int(input())
	(p, q) = (0, 0)
	z = 0
	for j in range(m):
		(x, y) = map(int, input().split())
		if x < p or y > x or y < q or (x - p < y - q):
			z = 1
		(p, q) = (x, y)
	if z == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for k in range(t):
	n = int(input())
	p = [None for _ in range(n + 1)]
	c = [None for _ in range(n + 1)]
	f = 0
	(p[0], c[0]) = (0, 0)
	for i in range(1, n + 1):
		(p[i], c[i]) = map(int, input().split())
	if p != sorted(p) or c != sorted(c):
		print('NO')
		continue
	for i in range(1, n + 1):
		if p[i] - p[i - 1] < c[i] - c[i - 1]:
			f = 1
			print('NO')
			break
	if f == 0:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	(p, c) = map(int, input().split())
	if c > p:
		for i in range(1, n):
			(p, c) = map(int, input().split())
		print('NO')
		continue
	ok = False
	for i in range(1, n):
		(p1, c1) = map(int, input().split())
		if p1 < p or c1 < c or c1 > p1 or (c > p):
			ok = True
		if p1 - p < c1 - c:
			ok = True
		(p, c) = (p1, c1)
		(p,)
	if ok:
		print('NO')
	else:
		print('YES')


def solve_case():
	n = int(input())
	inp = list((tuple(map(int, input().split())) for _ in range(n)))
	(a, b) = inp[0]
	for (ai, bi) in inp:
		if ai < bi:
			return 'NO'
		if ai < a:
			return 'NO'
		if bi < b:
			return 'NO'
		da = ai - a
		db = bi - b
		if db > da:
			return 'NO'
		(a, b) = (ai, bi)
	return 'YES'

def main():
	tests = int(input())
	for t in range(1, tests + 1):
		print(solve_case())
main()


t = int(input())
for i in range(t):
	n = int(input())
	p0 = 0
	c0 = 0
	failed = False
	for j in range(n):
		(p, c) = list(map(int, input().split()))
		if p < p0 or c < c0 or p - p0 < c - c0 or (p < c):
			failed = True
		p0 = p
		c0 = c
	if failed:
		print('NO')
	else:
		print('YES')


import sys
for _ in range(int(input())):
	n = int(sys.stdin.readline())
	p = 0
	c = 0
	f = 0
	for i in range(n):
		(x, y) = map(int, sys.stdin.readline().split())
		if x < p or y < c or x - p < y - c:
			f = 1
		p = x
		c = y
	if f:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	ch = 0
	s = list(map(int, input().split()))
	if s[0] < s[1]:
		ch = 1
	for k in range(n - 1):
		ss = list(map(int, input().split()))
		if ss[0] - s[0] < ss[1] - s[1] or ss[0] < s[0] or ss[1] < s[1]:
			ch = 1
		s = ss * 1
	if ch == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	po = -1
	co = -1
	flag = True
	for _ in range(n):
		(pn, cn) = (int(i) for i in input().split())
		if pn < po or cn < co or cn > pn or (cn - co > pn - po):
			flag = False
		(po, co) = (pn, cn)
	if flag:
		print('YES')
	else:
		print('NO')


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	r = []
	f = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		l.append(a)
		r.append(b)
	q = [r[0]]
	p = [l[0]]
	for i in range(1, n):
		p.append(l[i] - l[i - 1])
		q.append(r[i] - r[i - 1])
	for i in range(n):
		k = p[i] - q[i]
		if p[i] < 0 or q[i] < 0 or k < 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


for tc in range(int(input())):
	n = int(input())
	(a1, b1) = (0, 0)
	res = 'YES'
	for x in range(n):
		(a, b) = map(int, input().split())
		if b < b1 or a < a1 or a - b < a1 - b1:
			res = 'No'
		(a1, b1) = (a, b)
	print(res)


for _ in range(int(input())):
	n = int(input())
	(p, c) = map(int, input().split())
	flag = p >= c
	for _ in range(n - 1):
		(pnew, cnew) = map(int, input().split())
		flag = flag and pnew - p >= cnew - c >= 0
		(p, c) = (pnew, cnew)
	if flag:
		print('yes')
	else:
		print('no')


n = int(input())
for x in range(n):
	m = int(input())
	d = k = c = int(0)
	for y in range(m):
		(a, b) = map(int, input().split())
		if a < c or b < d:
			k = 1
		if b - d > a - c:
			k = 1
		c = a
		d = b
	if k == 1:
		print('NO')
	else:
		print('YES')


no_test = int(input())
for i in range(0, no_test):
	moment = int(input())
	(preplays, preclear) = (-1, -1)
	result = 'Yes'
	for j in range(0, moment):
		(plays, clears) = input().split(' ')
		plays = int(plays)
		clears = int(clears)
		if plays >= clears and (plays > preplays and clears in range(preclear, preclear + plays - preplays + 1) or (plays == preplays and clears == preclear)):
			(preplays, preclear) = (plays, clears)
		else:
			result = 'No'
	print(result)


for _ in range(int(input())):
	p_current = c_current = 0
	incomplete = True
	for _ in range(int(input())):
		(p_next, c_next) = (int(i) for i in input().split())
		if incomplete and (c_next - c_current > p_next - p_current or c_next < c_current or p_next < p_current):
			print('NO')
			incomplete = False
		else:
			(p_current, c_current) = (p_next, c_next)
	if incomplete:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	valid = True
	x = y = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		valid &= a >= b
		valid &= a >= x
		valid &= b >= y
		total_played = a - x
		total_won = b - y
		valid &= total_played >= total_won
		(x, y) = (a, b)
	print(['No', 'Yes'][valid])


for _ in range(int(input())):
	n = int(input())
	x = y = 0
	s = 'YES'
	for i in range(n):
		(p, c) = map(int, input().split())
		if c - x > p - y or 0 > min(c - x, p - y):
			s = 'NO'
		x = c
		y = p
	print(s)


def checklist(li):
	[p, c] = [0, 0]
	for i in li:
		if i[1] - c > i[0] - p or i[1] - c < 0 or i[0] - p < 0:
			return 'NO'
			break
		[p, c] = i
	else:
		return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	pairs = []
	for i in range(n):
		[p, c] = list(map(int, input().split()))
		pairs.append([p, c])
	print(checklist(pairs))


for _ in range(int(input())):
	n = int(input())
	p = [0] * n
	c = [0] * n
	for i in range(n):
		(p[i], c[i]) = list(map(int, input().split()))
	p_last = p[0]
	c_last = c[0]
	possible = p_last >= c_last
	for i in range(1, n):
		p_current = p[i]
		c_current = c[i]
		if c_current < c_last or p_current < p_last:
			possible = False
			break
		if c_current > p_current:
			possible = False
			break
		if c_current - c_last > p_current - p_last:
			possible = False
			break
		(p_last, c_last) = (p_current, c_current)
	if possible:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	prevplay = 0
	prevclear = 0
	flag = 0
	l = []
	for _ in range(n):
		l.append(list(map(int, input().split())))
	for i in range(n):
		(play, clear) = (l[i][0], l[i][1])
		if play < clear:
			print('no')
			flag = 1
			break
		if play < prevplay or clear < prevclear:
			print('no')
			flag = 1
			break
		dc = clear - prevclear
		dp = play - prevplay
		if dp < dc:
			print('no')
			flag = 1
			break
		prevclear = clear
		prevplay = play
	if flag != 1:
		print('yes')


t = int(input())
for q in range(t):
	n = int(input())
	p = []
	c = []
	for i in range(n):
		(u, v) = map(int, input().split())
		p.append(u)
		c.append(v)
	flag = 0
	if p[0] < c[0]:
		flag = 1
	else:
		i = 1
		while i < n:
			if p[i - 1] <= p[i] and c[i - 1] <= c[i] and (p[i] >= c[i]) and (p[i] - p[i - 1] >= c[i] - c[i - 1]):
				i += 1
			else:
				flag = 1
				break
	if flag == 1:
		print('NO')
	else:
		print('YES')


T = int(input())
for _ in range(T):
	n = int(input())
	(l_p, l_c, res) = (0, 0, 'YES')
	for _ in range(n):
		(p, c) = map(int, input().split())
		if l_p > p or l_c > c or c - l_c > p - l_p:
			res = 'NO'
		(l_p, l_c) = (p, c)
	print(res)


import sys
import math
import bisect

def solve(A):
	n = len(A)
	for i in range(n):
		if A[i][0] < A[i][1]:
			return False
		if i:
			dx = A[i][0] - A[i - 1][0]
			dy = A[i][1] - A[i - 1][1]
			if dx < 0:
				return False
			if dy < 0:
				return False
			if dx < dy:
				return False
	return True

def main():
	for _ in range(int(input())):
		n = int(input())
		A = []
		for i in range(n):
			A.append(list(map(int, input().split())))
		if solve(A):
			print('YES')
		else:
			print('NO')
main()


for q in range(int(input())):
	n = int(input())
	prev = [0, 0]
	check = True
	for i in range(n):
		(c, r) = map(int, input().split())
		if prev[0] > c or c - prev[0] < r - prev[1] or prev[1] > r:
			check = False
		prev = [c, r]
	if check:
		print('YES')
	else:
		print('NO')


def stats(n, array):
	cp = 0
	cc = 0
	for i in range(n):
		if array[i][0] - cp >= array[i][1] - cc:
			if i > 0:
				if array[i][0] < array[i - 1][0] or array[i][1] < array[i - 1][1]:
					print('NO')
					return
			cp = array[i][0]
			cc = array[i][1]
			continue
		else:
			print('NO')
			return
	print('YES')
	return
t = int(input())
array = []
for j in range(t):
	peeks = int(input())
	arrayc = []
	for k in range(peeks):
		arrayc.append(list(map(int, input().split(' '))))
	array.append([peeks, arrayc])
for x in array:
	stats(*x)


def solve(lst):
	for i in range(len(lst)):
		(a, b) = (lst[i][0], lst[i][1])
		if a < b:
			return False
		if i > 0 and (lst[i][0] < lst[i - 1][0] or lst[i][1] < lst[i - 1][1]):
			return False
		if i > 0 and 0 <= lst[i][0] - lst[i - 1][0] < lst[i][1] - lst[i - 1][1]:
			return False
	return True
m = int(input())
for i in range(m):
	n = int(input())
	lst = []
	for _ in range(n):
		(a, b) = list(map(int, input().split()))
		lst.append((a, b))
	if solve(lst):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	p = [list(map(int, input().split())) for _ in range(n)]
	p = [[a, b, a - b] for (a, b) in p]
	x = [[p[i][j] for i in range(n)] for j in range(3)]
	if all((sorted(x[i]) == x[i] for i in range(3))) and all((x[i][j] >= 0 for i in range(3) for j in range(n))):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	(p, c) = (0, 0)
	ans = True
	for _ in range(n):
		(curp, curc) = (int(x) for x in input().split())
		if curp < curc or curp < p or curc < c or (curc - c > curp - p):
			ans = False
		else:
			(p, c) = (curp, curc)
	print('YES' if ans else 'NO')


st = ''

def func():
	if p[0] < c[0]:
		return 'NO'
	for i in range(1, n):
		dp = p[i] - p[i - 1]
		dc = c[i] - c[i - 1]
		if dp < 0 or dc < 0 or dc > dp or (c[i] > p[i]):
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	(p, c) = ([], [])
	for i in range(n):
		(a, b) = map(int, input().split())
		p.append(a)
		c.append(b)
	st += str(func()) + '\n'
print(st)


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	ls = []
	for j in range(n):
		(p, c) = map(int, input().split(' '))
		ls.append(p)
		ls.append(c)
	k = 0
	flag = 0
	if n == 1:
		if ls[k] >= ls[k + 1]:
			ans.append('YES')
		else:
			ans.append('NO')
	else:
		while k < len(ls):
			if ls[k + 1] > ls[k]:
				ans.append('NO')
				flag = 1
				break
			if k > 1:
				tmp1 = ls[k] - ls[k - 2]
				tmp2 = ls[k + 1] - ls[k - 1]
				if tmp1 < 0 or tmp2 < 0 or tmp2 > tmp1:
					ans.append('NO')
					flag = 1
					break
			k += 2
		if flag == 0:
			ans.append('YES')
for x in range(t):
	print(ans[x])


for _ in range(int(input())):
	n = int(input())
	(p, c) = map(int, input().split())
	flag = 0
	if c > p:
		flag = 1
	for _ in range(n - 1):
		(x, y) = map(int, input().split())
		if x < p or y < c or y - c > x - p or (y > x):
			flag = 1
		p = x
		c = y
	print('NO' if flag else 'YES')


t = int(input())
for i in range(0, t):
	n = int(input())
	a = []
	b = []
	for j in range(0, n):
		(c, d) = map(int, input().split())
		a.append(c)
		b.append(d)
	k = 0
	for j in range(0, n):
		if b[j] > a[j]:
			print('NO')
			k = k + 1
			break
		if j > 0:
			if a[j] - a[j - 1] < 0 or b[j] - b[j - 1] < 0:
				print('NO')
				k = k + 1
				break
			if a[j] - a[j - 1] < b[j] - b[j - 1]:
				print('NO')
				k = k + 1
				break
	if k == 0:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	(a, b) = (0, 0)
	res = True
	for i in range(n):
		(c, d) = map(int, input().split())
		if c - a < d - b or (a > c or b > d):
			res = False
		(a, b) = (c, d)
	print(('NO', 'YES')[res])


for _ in range(int(input())):
	(n,) = map(int, input().split())
	x = [[0, 0]] + [list(map(int, input().split())) for _ in range(n)]
	print('Yes' if all((u1 >= u and v1 >= v and (u1 - u >= v1 - v) for ((u, v), (u1, v1)) in zip(x, x[1:]))) else 'No')


import sys
from math import log2, ceil
input = sys.stdin.readline

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a > 0:
		return gcd(b % a, a)
	return b

def primefs(n):
	if n == 1:
		return 1
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, size, link):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def int_array():
	return list(map(int, input().split()))
for _ in range(int(input())):
	n = int(input())
	a = []
	for i in range(n):
		(p, c) = int_array()
		a.append((p, c))
	(pi, ci) = (-1, -1)
	flag = True
	for i in range(n):
		(p, c) = a[i]
		dp = p - pi
		dc = c - ci
		if dp < dc or dp < 0 or dc < 0:
			flag = False
			break
		pi = p
		ci = c
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	ans = True
	l = []
	for i in range(n):
		(p, c) = map(int, input().split())
		l.append((p, c))
	p = l[0][0]
	c = l[0][1]
	for i in range(1, n):
		if c > p:
			ans = False
		if p > l[i][0]:
			ans = False
		if c > l[i][1]:
			ans = False
		if c > l[i][0]:
			ans = False
		if l[i][0] - p < l[i][1] - c:
			ans = False
		p = l[i][0]
		c = l[i][1]
	if c > p:
		ans = False
	if ans:
		print('YES')
	else:
		print('NO')


import sys

def main():
	mod = 998244353

	def GCD(x, y):
		while y:
			(x, y) = (y, x % y)
		return x

	def lcm(a, b):
		return a * b // GCD(a, b)

	def merge(a, start, mid, end, d):
		p = start
		q = mid + 1
		arr = [0] * (end - start + 1)
		k = 0
		coun = 0
		for i in range(start, end + 1):
			if p > mid:
				arr[k] = a[q]
				q += 1
				k += 1
			elif q > end:
				arr[k] = a[p]
				d[a[p]] += coun
				k += 1
				p += 1
			elif a[p] < a[q]:
				arr[k] = a[p]
				d[a[p]] += coun
				k += 1
				p += 1
			else:
				arr[k] = a[q]
				k += 1
				q += 1
				coun += 1
		for i in range(k):
			a[start] = arr[i]
			start += 1

	def mergesort(a, start, end, d):
		if start < end:
			mid = (start + end) // 2
			mergesort(a, start, mid, d)
			mergesort(a, mid + 1, end, d)
			merge(a, start, mid, end, d)

	def inversion(l):
		d = {}
		for i in l:
			d[i] = 0
		mergesort(l, 0, len(l) - 1, d)
		return d

	def binary_search_lower(A, low, high, k):
		if high - low != 1:
			mid = (low + high) // 2
			x = A[mid]
			if x >= k:
				return binary_search_lower(A, low, mid, k)
			else:
				return binary_search_lower(A, mid, high, k)
		if A[low] >= k:
			return low
		else:
			return high

	def binary_expo(x, n):
		if n == 0:
			return 1
		elif n % 2 == 0:
			return binary_expo(x * x, n // 2)
		else:
			return x * binary_expo(x * x, (n - 1) // 2)

	def modu_expo(x, n, m):
		if n == 0:
			return 1
		elif n % 2 == 0:
			return modu_expo(x * x % m, n // 2, m)
		else:
			return x * modu_expo(x * x % m, (n - 1) // 2, m) % m

	def eEuclid(c, m):
		if m == 0:
			global d
			global x
			global y
			d = c
			x = 1
			y = 0
		else:
			eEuclid(m, c % m)
			temp = x
			x = y
			y = temp - c // m * y

	def mod_Inv(c, m):
		eEuclid(c, m)
		return (x % m + m) % m

	def ncr(n, r, p):
		num = den = 1
		for i in range(r):
			num = num * (n - i) % p
			den = den * (i + 1) % p
		return num * pow(den, p - 2, p) % p
	for _ in range(int(sys.stdin.readline())):
		n = int(sys.stdin.readline())
		ans = 'YES'
		(x, y) = (0, 0)
		for i in range(n):
			(a, b) = map(int, sys.stdin.readline().split())
			if a < b:
				ans = 'NO'
			elif a < x or b < y:
				ans = 'NO'
			elif a - x < b - y:
				ans = 'NO'
			x = a
			y = b
		print(ans)
main()


answers = []
for i in range(int(input())):
	(li, p_old, c_old) = ([], 0, 0)
	for j in range(int(input())):
		li.append(map(int, input().split()))
	for (p, c) in li:
		if p < p_old or c > p or c < c_old or (c - c_old > p - p_old):
			answers.append('NO')
			break
		(p_old, c_old) = (p, c)
	else:
		answers.append('YES')
print('\n'.join(answers))


for _ in range(int(input())):
	n = int(input())
	p = [0] * n
	c = [0] * n
	for i in range(n):
		(p[i], c[i]) = map(int, input().split())
	ans = True
	if p[0] < c[0]:
		print('NO')
		continue
	for i in range(1, n):
		if p[i - 1] > p[i] or c[i - 1] > c[i] or p[i] < c[i] or (c[i] - c[i - 1] > p[i] - p[i - 1]):
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	lis = [0] * int(input())
	for i in range(len(lis)):
		x = list(map(int, input().split()))
		lis[i] = x
	if len(lis) == 1:
		if lis[0][0] >= lis[0][1]:
			print('YES')
		else:
			print('NO')
	else:
		x = lis[0][0]
		y = lis[0][1]
		z = x - y
		if z < 0:
			print('NO')
		else:
			k = 0
			for i in range(1, len(lis)):
				if lis[i][0] < x or lis[i][1] < y:
					k = 1
					print('NO')
					break
				x = lis[i][0]
				y = lis[i][1]
				if z > x - y:
					k = 1
					print('NO')
					break
				z = x - y
			if k == 0:
				print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	(a, b) = map(int, input().split())
	m = a >= b
	for __ in range(n - 1):
		(c, d) = map(int, input().split())
		m = m and c >= a + d - b and (d >= b)
		a = c
		b = d
	if m:
		print('Yes')
	else:
		print('No')


n = int(input())
while n > 0:
	m = int(input())
	l = []
	ans = 'YES'
	for i in range(m):
		l.append(list(map(int, input().split())))
	if l[0][0] < l[0][1]:
		ans = 'NO'
	for j in range(1, m):
		if l[j][0] < l[j - 1][0] or l[j][1] < l[j - 1][1] or l[j][0] < l[j][1] or (l[j][0] - l[j - 1][0] < l[j][1] - l[j - 1][1]):
			ans = 'NO'
	print(ans)
	n -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	okay = 0
	(prevA, prevB) = (0, 0)
	for i in range(n):
		(a, b) = map(int, input().split())
		if b > a:
			okay = 1
		elif prevA > a or prevB > b:
			okay = 1
		if a - prevA < b - prevB:
			okay = 1
		prevA = a
		prevB = b
	if not okay:
		print('YES')
	else:
		print('NO')


t = int(input())
for v in range(t):
	adj = []
	n = int(input())
	for i in range(n):
		li = list(map(int, input().split(' ')))
		adj.append(li)
	li = adj[0]
	if li[1] > li[0]:
		print('NO')
		continue
	else:
		flag = 1
		for j in range(1, n):
			pr = adj[j - 1]
			li = adj[j]
			if li[1] > li[0]:
				flag = 0
				break
			if li[0] < pr[0]:
				flag = 0
				break
			if li[1] < pr[1]:
				flag = 0
				break
			if li[0] == pr[0] and pr[1] != li[1]:
				flag = 0
				break
			if li[1] - pr[1] > li[0] - pr[0]:
				flag = 0
				break
	if flag:
		print('YES')
	else:
		print('NO')


from sys import stdin

def f(A):
	if A[0][1] > A[0][0]:
		return 'NO'
	for i in range(1, len(A)):
		ad = A[i][0] - A[i - 1][0]
		cd = A[i][1] - A[i - 1][1]
		if ad >= 0 and cd >= 0 and (ad >= cd) and (A[i][0] >= A[i][1]):
			continue
		else:
			return 'NO'
	return 'YES'
n = int(input())
for i in range(n):
	t = int(input())
	A = []
	for j in range(t):
		(a, p) = [int(i) for i in stdin.readline().split()]
		A.append([a, p])
	print(f(A))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]

def N():
	return int(inp())
dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]

def YES():
	print('YES')

def NO():
	print('NO')

def Yes():
	print('Yes')

def No():
	print('No')
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24

class MergeFind:

	def __init__(self, n):
		self.parent = list(range(n))
		self.size = [1] * n
		self.num_sets = n

	def find(self, a):
		to_update = []
		while a != self.parent[a]:
			to_update.append(a)
			a = self.parent[a]
		for b in to_update:
			self.parent[b] = a
		return self.parent[a]

	def merge(self, a, b):
		a = self.find(a)
		b = self.find(b)
		if a == b:
			return
		self.num_sets -= 1
		self.parent[a] = b
		self.size[b] += self.size[a]

	def set_size(self, a):
		return self.size[self.find(a)]

	def __len__(self):
		return self.num_sets

def lcm(a, b):
	return abs(a // gcd(a, b) * b)

def solve():
	n = N()
	a = []
	b = []
	for i in range(n):
		(t, y) = sep()
		a.append(t)
		b.append(y)
	if a[0] < b[0]:
		NO()
		return
	for i in range(1, n):
		da = a[i] - a[i - 1]
		db = b[i] - b[i - 1]
		if da < db or da < 0 or db < 0:
			NO()
			return
	YES()
testcase(int(inp()))


for _ in range(int(input())):
	n = int(input())
	p = 0
	c = 0
	des = True
	for i in range(n):
		(temp1, temp2) = map(int, input().split())
		if temp1 < p or temp2 < c or temp1 - p < temp2 - c:
			des = False
		p = temp1
		c = temp2
	if des:
		print('YES')
	else:
		print('NO')


for tc in range(int(input())):
	n = int(input())
	(am, bm) = (0, 0)
	res = 'YES'
	for i in range(n):
		(a, b) = map(int, input().split())
		if a < am or b < bm or a - b < am - bm:
			res = 'NO'
		(am, bm) = (a, b)
	print(res)


T = int(input())
for i in range(T):
	n = int(input())
	pold = cold = 0
	res = True
	for j in range(n):
		(p, c) = [int(k) for k in input().split()]
		if c - cold > p - pold or c < cold or p < pold:
			res = False
		(pold, cold) = (p, c)
	print('YES' if res else 'NO')


for _ in range(int(input())):
	n = int(input())
	(p, c) = list(map(int, input().split()))
	diff = p - c
	flag = True
	if diff < 0:
		flag = False
	for i in range(1, n):
		(pi, ci) = list(map(int, input().split()))
		diffi = pi - ci
		if not (pi >= p and ci >= c and (pi >= ci) and (diffi >= diff)):
			flag = False
		(p, c, diff) = (pi, ci, diffi)
	if flag:
		print('YES')
	else:
		print('NO')


from collections import Counter
import math
t = int(input())
for _ in range(t):
	n = int(input())
	(px, py) = list(map(int, input().split()))
	cc = 0
	for __ in range(n - 1):
		(x, y) = list(map(int, input().split()))
		if cc == 1:
			continue
		if not (x - px >= 0 and y - py >= 0 and (y - py <= x - px) and (px >= py)):
			cc = 1
		px = x
		py = y
	if n == 1:
		if px >= py:
			print('YES')
		else:
			print('NO')
	elif cc == 0:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	N = int(input())
	prev = [0, 0]
	poss = True
	for n in range(N):
		cur = [int(x) for x in input().split(' ')]
		pd = cur[0] - prev[0]
		wd = cur[1] - prev[1]
		if pd < wd or pd < 0 or wd < 0:
			poss = False
		prev = cur
	if poss:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	isPossible = True
	c_old = 0
	p_old = 0
	for j in range(n):
		(p, c) = list(map(int, input().split()))
		if p < p_old or c < c_old:
			isPossible = False
		if p < c:
			isPossible = False
		if p - p_old < c - c_old:
			isPossible = False
		c_old = c
		p_old = p
	if isPossible:
		print('YES')
	else:
		print('NO')


from sys import stdin
import math

def inp():
	return stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	p = [0] * n
	c = [0] * n
	no = False
	for i in range(n):
		(p[i], c[i]) = [int(x) for x in inp().split()]
		if i > 0:
			if p[i] < p[i - 1] or c[i] < c[i - 1] or p[i] - p[i - 1] < c[i] - c[i - 1]:
				no = True
		if c[i] > p[i]:
			no = True
	if no:
		print('NO')
	else:
		print('YES')


t = int(input())
for case in range(t):
	n = int(input())
	(p_last, c_last) = (0, 0)
	ans = 'YES'
	for peek in range(n):
		(p, c) = [int(x) for x in input().split(' ')]
		if p < p_last or c < c_last or c > c_last + p - p_last:
			ans = 'NO'
		(p_last, c_last) = (p, c)
	print(ans)


t = int(input())
out = list()
for item in range(t):
	n = int(input())
	old = [0, 0]
	OK = 0
	for item in range(n):
		pc_list = input().split()
		p = int(pc_list[0])
		c = int(pc_list[1])
		if p < c:
			OK = 0
		elif p - old[0] < 0 or c - old[1] < 0:
			OK = 0
		elif p - old[0] < c - old[1]:
			OK = 0
		else:
			OK += 1
		old = [p, c]
	if OK == n:
		out.append('YES')
	else:
		out.append('NO')
for item in out:
	print(item)


for _ in range(int(input())):
	am = int(input())
	(a, b) = list(map(int, input().split()))
	arr = []
	if a < b:
		for g in range(am - 1):
			a = input()
		print('NO')
		continue
	for i in range(am - 1):
		(a1, b1) = list(map(int, input().split()))
		if a1 - a < b1 - b or a1 < a or b1 < b:
			print('NO')
			for g in range(am - (i + 2)):
				a = input()
			break
		a = a1
		b = b1
	else:
		print('YES')


def solve(A):
	plays = 0
	clears = 0
	for index in A:
		P = index[0]
		C = index[1]
		newPlays = P - plays
		newClears = C - clears
		if newPlays < 0 or newClears < 0 or newPlays < newClears:
			return False
		plays = P
		clears = C
	return True

def convertArrayToInt(A):
	for i in range(0, len(A), 1):
		A[i] = int(A[i])
	return A
testCases = int(input())
while testCases:
	n = int(input())
	indices = []
	while n:
		X = input().split()
		X = convertArrayToInt(X)
		indices.append([X[0], X[1]])
		n -= 1
	ans = solve(indices)
	if ans:
		print('YES')
	else:
		print('NO')
	testCases -= 1


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	N = int(input())
	PC = [list(map(int, input().split())) for _ in range(N)]
	(old_p, old_c) = (0, 0)
	for (p, c) in PC:
		if p - old_p < c - old_c or old_p > p or old_c > c:
			break
		(old_p, old_c) = (p, c)
	else:
		print('YES')
		continue
	print('NO')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	arr = []
	for i in range(n):
		pair = list(map(int, input().split()))
		arr.append(pair)
	c = 0
	p = 0
	flag = True
	d = {}
	for i in range(len(arr)):
		if arr[i][0] < arr[i][1] or arr[i][1] < c or arr[i][0] < p or (arr[i][1] - c > arr[i][0] - p):
			flag = False
			break
		if arr[i][0] in d.keys():
			if arr[i][1] != d[arr[i][0]]:
				flag = False
				break
		else:
			d[arr[i][0]] = arr[i][1]
		(c, p) = (arr[i][1], arr[i][0])
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ans = 'YES'
	cur = [-1, -1]
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < cur[0]:
			ans = 'NO'
		if c < cur[1]:
			ans = 'NO'
		d = c - cur[1]
		if p - cur[0] < d:
			ans = 'NO'
		cur = [p, c]
	print(ans)


for _ in range(int(input())):
	n = int(input())
	(p, c) = ([], [])
	for i in range(n):
		(x, y) = map(int, input().split())
		p.append(x)
		c.append(y)
	t = 'YES'
	for i in range(1, n):
		x = p[i] - p[i - 1]
		y = c[i] - c[i - 1]
		if x < y:
			t = 'NO'
			break
		elif x < 0 or y < 0:
			t = 'NO'
			break
	x = p[0]
	y = c[0]
	if x < y:
		t = 'NO'
	elif x < 0 or y < 0:
		t = 'NO'
	print(t)


def solve():
	n = int(input())
	pc = [[int(x) for x in input().split()] for i in range(n)]
	(p, c) = zip(*pc)
	(pn, cn) = (0, 0)
	for (pi, ci) in zip(p, c):
		if pi < pn or ci < cn or pi - pn < ci - cn:
			return 'NO'
		(pn, cn) = (pi, ci)
	return 'YES'
T = int(input())
for _ in range(T):
	print(solve())


for _ in range(int(input())):
	n = int(input())
	(a, b, k) = (0, 0, 0)
	for i in range(n):
		(p, c) = map(int, input().split())
		if p >= a and c >= b and (p - a >= c - b):
			a = p
			b = c
		else:
			k = 1
	if k == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	r = 0
	l = []
	(a, b) = map(int, input().split())
	if b > a:
		r = 1
	l.append([a, b])
	for i in range(1, n):
		(a, b) = map(int, input().split())
		if a >= l[i - 1][0] and b >= l[i - 1][1] and (a >= b) and (b - l[i - 1][1] <= a - l[i - 1][0]):
			pass
		else:
			r = 1
		l.append([a, b])
	if r == 1:
		print('NO')
	else:
		print('YES')


from sys import stdin
rInt = lambda : int(stdin.readline().strip('\n'))
rIntArray = lambda : [int(x) for x in stdin.readline().split()]
rString = lambda : stdin.readline().strip('\n')
rStrArray = lambda : [x for x in stdin.readline().split()]
for _ in range(rInt()):
	n = rInt()
	(p, c) = ([0] * n, [0] * n)
	for i in range(n):
		(p[i], c[i]) = rIntArray()
	flag = True
	(p_count, c_count) = (0, 0)
	for i in range(n):
		if p[i] < p_count or c[i] < c_count or p[i] - p_count < c[i] - c_count:
			flag = False
			break
		(p_count, c_count) = (p[i], c[i])
	print('YES' if flag else 'NO')


for i in range(int(input())):
	n = int(input())
	ok = True
	(a, b) = (0, 0)
	for j in range(n):
		(c, d) = map(int, input().split())
		if c - a < d - b or a > c or b > d:
			ok = False
		(a, b) = (c, d)
	if ok == True:
		print('YES')
	else:
		print('NO')


from math import cos, e
import bisect as bs
from math import *

def pro(arr):
	(p, c) = arr[0]
	if c > p:
		print('NO')
		return
	n = len(arr)
	for i in range(1, n):
		(a, b) = arr[i]
		if c > b or p > a or b - c > a - p:
			print('NO')
			return
		(p, c) = (a, b)
	print('YES')
t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	for j in range(n):
		arr.append(list(map(int, input().split())))
	pro(arr)


T = int(input())

def is_ok(stats):
	for i in range(len(stats) - 1):
		if stats[i][0] > stats[i + 1][0] or stats[i][1] > stats[i + 1][1]:
			return 'NO'
		if stats[i + 1][0] - stats[i][0] < stats[i + 1][1] - stats[i][1]:
			return 'NO'
		if stats[i][1] > stats[i][0]:
			return 'NO'
	if stats[len(stats) - 1][1] > stats[len(stats) - 1][0]:
		return 'NO'
	else:
		return 'YES'

def solve():
	n = int(input())
	stats = [tuple(map(int, input().split())) for _ in range(n)]
	print(is_ok(stats))
for i in range(T):
	solve()


for _ in range(int(input())):
	n = int(input())
	first = input().split()
	(plays, clears) = (int(first[0]), int(first[1]))
	possible = True
	if clears > plays:
		possible = False
	for i in range(n - 1):
		value = input().split()
		(current_plays, current_clears) = (int(value[0]), int(value[1]))
		if possible:
			if current_clears - clears > current_plays - plays or current_plays < plays or current_clears < clears:
				possible = False
		(plays, clears) = (current_plays, current_clears)
	if possible:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	m = int(input())
	flag = True
	prev_c = 0
	prev_p = 0
	for __ in range(m):
		inp = list(map(int, input().split()))
		if prev_p > inp[0] or prev_c > inp[1] or inp[0] < inp[1] or (inp[0] - prev_p < inp[1] - prev_c):
			flag = False
		prev_p = inp[0]
		prev_c = inp[1]
	if flag:
		print('YES')
	else:
		print('NO')


import sys
input = lambda : sys.stdin.readline().rstrip()

def zap():
	n = int(input())
	(lp, lc) = map(int, input().split())
	ans = 'YES'
	if lc > lp:
		ans = 'NO'
	if n == 1:
		return ans
	for i in range(n - 1):
		(p, c) = map(int, input().split())
		if c - lc > p - lp or lc > c or lp > p:
			ans = 'NO'
		lc = c
		lp = p
	if c - lc > p - lp or lc > c or lp > p:
		ans = 'NO'
	return ans
for i in range(int(input())):
	print(zap())


for _ in range(int(input())):
	n = int(input())
	a = []
	for _ in range(n):
		(p, c) = map(int, input().split())
		a.append((p, c))
	if a[0][1] <= a[0][0] and all((c2 - c1 <= p2 - p1 and c1 <= c2 and (p1 <= p2) for ((p1, c1), (p2, c2)) in zip(a, a[1:]))):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	ca = 0
	cb = 0
	ans = True
	for i in range(n):
		(a, b) = map(int, input().split())
		if b > cb:
			if b - cb > a - ca:
				ans = False
			cb = b
			if a > ca:
				ca = a
			else:
				ans = False
		elif b < cb:
			ans = False
		if a >= ca:
			ca = a
		else:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	N = int(input())
	p0 = 0
	c0 = 0
	d0 = 0
	ris = True
	for n in range(N):
		(p, c) = map(int, input().split())
		d = p - c
		if c > p or p < p0 or c < c0 or (d < d0):
			ris = False
		p0 = p
		c0 = c
		d0 = d
	if ris:
		print('YES')
	else:
		print('NO')


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def solve():
	n = int(input().strip())
	records = [[0, 0]]
	for _ in range(n):
		records.append([int(s) for s in input().strip().split()])
	result = all((0 <= c2 - c1 <= p2 - p1 for ((p1, c1), (p2, c2)) in zip(records, records[1:])))
	print('YES' if result else 'NO')

def main():
	for _ in range(int(input().strip())):
		solve()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = sys.stdin.readline
from collections import *
from math import *
t = int(input())
while t:
	t -= 1
	n = int(input())
	flag = 0
	(p, c) = map(int, input().split())
	if c > p:
		flag = 1
	for i in range(n - 1):
		(x, y) = map(int, input().split())
		if x >= p and y >= c and (y <= x) and (y - c <= x - p):
			p = x
			c = y
			continue
		flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


ans = []
for i in range(int(input())):
	in_p = 0
	in_c = 0
	flag = 0
	for j in range(int(input())):
		(p, c) = map(int, input().split())
		if c > p:
			flag = 1
		if p < in_p:
			flag = 1
		if c < in_c:
			flag = 1
		if c - in_c > p - in_p:
			flag = 1
		in_p = p
		in_c = c
	if not flag:
		ans.append('YES')
	else:
		ans.append('NO')
print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	r = 1
	(p, c) = ([0] * n, [0] * n)
	for i in range(n):
		(p[i], c[i]) = map(int, input().split())
	if p[0] < c[0]:
		print('NO')
	else:
		for i in range(1, n):
			dp = p[i] - p[i - 1]
			dc = c[i] - c[i - 1]
			if c[i] > p[i]:
				r = 0
			elif c[i - 1] > c[i] or p[i] < p[i - 1]:
				r = 0
			elif c[i] > c[i - 1] and dp < dc:
				r = 0
		if r == 0:
			print('NO')
		else:
			print('YES')


I = input
for _ in [0] * int(I()):
	w = y = 0
	f = 1
	for _ in [0] * int(I()):
		(p, c) = map(int, I().split())
		f &= 0 <= c - y <= p - w
		w = p
		y = c
	print('NYOE S'[f::2])


def solver(k):
	p = 0
	c = 0
	pp = 0
	pc = 0
	com = 0
	for j in range(0, k):
		arr = [int(num) for num in input().split()]
		p = arr[0]
		c = arr[1]
		if pp > p or pc > c or p - pp < c - pc:
			com = 1
		pp = p
		pc = c
	if com == 1:
		return 'No'
	else:
		return 'Yes'
i = int(input())
for j in range(0, i):
	k = int(input())
	print(solver(k))


def solve(n):
	if l[0][0] < l[0][1]:
		print('NO')
		return
	for i in range(1, n):
		if l[i][0] < l[i - 1][0] or l[i][1] < l[i - 1][1] or l[i][0] - l[i - 1][0] < l[i][1] - l[i - 1][1]:
			print('NO')
			return
	print('YES')
	return
t = int(input())
for _ in range(t):
	n = int(input())
	l = [list(map(int, input().split())) for i in range(n)]
	solve(n)


t = int(input())
for j in range(t):
	ans = 'YES'
	n = int(input())
	initial_p = 0
	initial_c = 0
	for i in range(n):
		w = input().split()
		p = int(w[0])
		c = int(w[1])
		if c > p or (p < initial_p or c < initial_c) or p - initial_p < c - initial_c:
			ans = 'NO'
		initial_p = p
		initial_c = c
	print(ans)


for _ in range(int(input())):
	num = int(input())
	queue = []
	for k in range(num):
		(a, b) = map(int, input().split())
		queue.append([a, b])
	current = queue.pop(0)
	ans = 'YES'
	if current[1] > current[0]:
		ans = 'NO'
	while len(queue) != 0:
		temp = queue.pop(0)
		if temp[1] > temp[0]:
			ans = 'NO'
			break
		else:
			pdiff = temp[0] - current[0]
			cdiff = temp[1] - current[1]
			if cdiff <= pdiff and cdiff >= 0:
				current = temp
			else:
				ans = 'NO'
				break
	print(ans)


n = int(input())
for i in range(n):
	m = int(input())
	last = (-1, -1)
	can = True
	for g in range(m):
		(a, b) = map(int, input().split())
		if (a < last[0] or b < last[1] or a - last[0] < b - last[1]) and last[0] != -1:
			can = False
		if a < b:
			can = False
		last = (a, b)
	if not can:
		print('NO')
	else:
		print('YES')


T = int(input())
for i in range(T):
	n = int(input())
	(p_prev, c_prev) = (0, 0)
	flag = True
	for j in range(n):
		(p, c) = map(int, input().split())
		if c - c_prev >= 0 and p - p_prev >= c - c_prev and flag:
			(p_prev, c_prev) = (p, c)
		else:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


for ahfiuyh in range(int(input())):
	n = int(input())
	a = [list(map(int, input().split())) for i in range(n)]
	cc = [0, 0]
	f = True
	for i in a:
		if i[1] > i[0]:
			print('NO')
			f = False
			break
		elif i[0] < cc[0]:
			print('NO')
			f = False
			break
		elif i[1] < cc[1]:
			print('NO')
			f = False
			break
		elif i[1] - cc[1] > i[0] - cc[0]:
			print('NO')
			f = False
			break
		cc = i
	if f:
		print('YES')


def solve():
	n = int(input())
	pprv = 0
	cprv = 0
	result = True
	for i in range(0, n):
		line = list(map(lambda x: int(x), input().split()))
		pnow = line[0]
		cnow = line[1]
		if result:
			if pnow >= pprv and cnow >= cprv and (pnow - pprv >= cnow - cprv):
				pprv = pnow
				cprv = cnow
			else:
				result = False
	if result:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(0, t):
	solve()


for _ in range(int(input())):
	(oldp, oldc) = (0, 0)
	n = int(input())
	pairs = [tuple(map(int, input().split())) for x in range(n)]
	for (p, c) in pairs:
		if p < oldp or c < oldc:
			print('NO')
			break
		elif p - oldp < c - oldc:
			print('NO')
			break
		(oldp, oldc) = (p, c)
	else:
		print('YES')


t = int(input())
for k in range(t):
	n = int(input())
	p = [0] * (n + 1)
	c = [0] * (n + 1)
	test = True
	for i in range(1, n + 1):
		ch = input()
		L = [int(j) for j in ch.split()]
		(p[i], c[i]) = (L[0], L[1])
		if p[i] < p[i - 1] or p[i] < c[i] or c[i] < c[i - 1] or (p[i] - p[i - 1] < c[i] - c[i - 1]):
			test = False
	if test:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	ans = True
	n = int(input())
	(p_max, c_max) = (0, 0)
	p = [0] * n
	c = [0] * n
	for i in range(n):
		(pp, cc) = map(int, input().split())
		(p[i], c[i]) = (pp, cc)
	for i in range(n):
		if p[i] < c[i]:
			ans = False
			break
		if p[i] < p_max:
			ans = False
			break
		else:
			p_diff = p[i] - p_max
			p_max = p[i]
		if c[i] < c_max:
			ans = False
			break
		else:
			c_diff = c[i] - c_max
			c_max = c[i]
		if p_diff < c_diff:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	(c, d) = (0, 0)
	bo = 0
	for i in range(n):
		(a, b) = list(map(int, input().split()))
		if a < c or b < d:
			bo = 1
		elif a - c < b - d:
			bo = 1
		(c, d) = (a, b)
	if bo:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	(n, r) = (int(input()), 0)
	(p, v) = map(int, input().split())
	if p < 0 or v < 0 or v > p:
		r = 1
	for i in range(n - 1):
		(a, b) = map(int, input().split())
		if a - p < b - v or a < p or b < v:
			r = 1
		(p, v) = (a, b)
	if r == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	failflag = 0
	n = int(input())
	(a, b) = map(int, input().split())
	if b > a:
		failflag = 1
	for j in range(n - 1):
		(c, d) = map(int, input().split())
		if d - b > c - a:
			failflag = 1
		if d < b:
			failflag = 1
		if c < a:
			failflag = 1
		(a, b) = (c, d)
	if failflag == 0:
		print('YES')
	else:
		print('NO')


test = int(input())
for i in range(test):
	n = int(input())
	game = list()
	status = 0
	for j in range(n):
		game.append(list(map(int, input().split())))
	(p0, p1) = (0, 0)
	for k in game:
		if k[0] < k[1]:
			status = 1
			break
		if p0 > k[0] or p1 > k[1]:
			status = 1
			break
		diff1 = k[1] - p1
		diff0 = k[0] - p0
		if diff1 > diff0:
			status = 1
			break
		p0 = k[0]
		p1 = k[1]
	if status == 0:
		print('YES')
	else:
		print('NO')


def ans(n):
	flag = True
	(lastP, lastC) = (0, 0)
	for i in range(n):
		(newP, newC) = map(int, input().split())
		if i == 0:
			if not newP >= newC:
				flag = False
			(lastP, lastC) = (newP, newC)
		elif newP >= lastP and newC >= lastC:
			newClears = newC - lastC
			newPlays = newP - lastP
			if not newPlays >= newClears:
				flag = False
			(lastP, lastC) = (newP, newC)
		else:
			flag = False
	return flag
for t in range(int(input())):
	n = int(input())
	if ans(n):
		print('YES')
	else:
		print('NO')


t = int(input())
for q in range(t):
	n = int(input())
	(mp, mc) = (0, 0)
	f = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if p - mp < c - mc or p < mp or c < mc:
			f = 1
		mp = p
		mc = c
	if f == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	prev1 = 0
	prev2 = 0
	flag = 0
	for __ in range(n):
		(a, b) = map(int, input().split())
		if flag != 1:
			if a < prev1:
				print('NO')
				flag = 1
				continue
			elif a > prev1:
				no = a - prev1
				if b > prev2 + no:
					flag = 1
					print('NO')
					continue
				if b < prev2:
					flag = 1
					print('NO')
					continue
			elif prev2 != b:
				flag = 1
				print('NO')
				continue
		prev1 = a
		prev2 = b
	if flag != 1:
		print('YES')


for _ in range(int(input())):
	N = int(input())
	Last = list(map(int, input().split()))
	Countinue = False
	if Last[1] > Last[0]:
		Countinue = True
	for i in range(N - 1):
		Temp = list(map(int, input().split()))
		Check = Temp[0] - Last[0]
		if Countinue == False:
			if Temp[0] == Last[0] and Temp[1] != Last[1]:
				Countinue = True
			if Check < 0 or Temp[1] - Last[1] < 0 or Temp[1] - Last[1] > Check:
				Countinue = True
		Last = Temp[:]
	if Countinue:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	flag = True
	(p_prev, c_prev) = map(int, input().split())
	if p_prev < c_prev:
		flag = False
	for j in range(1, n):
		(p, c) = map(int, input().split())
		if (p_prev > p) | (c_prev > c) | (p < c) | (p - p_prev < c - c_prev):
			flag = False
		p_prev = p
		c_prev = c
	if flag == False:
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	n = int(input())
	a = []
	f = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if c > p:
			f = False
		for (x, y) in a:
			if p < x:
				f = False
			if p == x and y != c:
				f = False
			if c < y:
				f = False
			if c - y > p - x:
				f = False
		a.append((p, c))
	print('YES' if f else 'NO')


t = int(input())
for i in range(t):
	check = True
	p = c = 0
	n = int(input())
	for e in range(n):
		s = input()
		l = [int(x) for x in s.split(' ')]
		if l[0] < p or l[1] < c or l[1] - c > l[0] - p:
			check = False
		(p, c) = (l[0], l[1])
	if not check:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	(ep, ec, cnt) = (0, 0, 1)
	for i in range(n):
		(p, c) = map(int, input().split())
		if p >= c and (p > ep and c >= ec and (p - ep >= c - ec) or (p == ep and c == ec)):
			ep = p
			ec = c
		else:
			cnt = 0
	if cnt == 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	plays = []
	clears = []
	flag = 1
	for i in range(n):
		(a, b) = input().split()
		if int(a) < int(b):
			flag = 0
		plays.append(int(a))
		clears.append(int(b))
	if flag and sorted(plays) == plays and (sorted(clears) == clears):
		plays = sorted(plays)
		clears = sorted(clears)
		flag2 = 1
		for i in range(1, n):
			if not plays[i] - plays[i - 1] >= clears[i] - clears[i - 1]:
				print('NO')
				flag2 = 0
				break
		if flag2:
			print('YES')
	else:
		print('NO')


from sys import stdin, stdout
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	n = ii1()
	arr = [[0, 0]]
	for i in range(n):
		arr.append(iia())
	for i in range(1, n + 1):
		if arr[i][1] > arr[i][0]:
			print('NO')
			break
		elif arr[i][0] < arr[i - 1][0] or arr[i][1] < arr[i - 1][1]:
			print('NO')
			break
		elif arr[i][0] - arr[i - 1][0] < arr[i][1] - arr[i - 1][1]:
			print('NO')
			break
	else:
		print('YES')


import sys
input = sys.stdin.readline
from math import *

def bo(i):
	return ord(i) - ord('a') + 1
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	flag = 0
	prevp = 0
	prevc = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if flag == 1:
			continue
		elif p < prevp or c < prevc:
			flag = 1
			continue
		elif p - prevp < c - prevc:
			flag = 1
			continue
		elif p < c:
			flag = 1
			continue
		prevp = p
		prevc = c
	print('YES' if flag == 0 else 'NO')


for _ in range(int(input())):
	(a, b) = (0, 0)
	(state, T) = (True, True)
	n = int(input())
	array = []
	for i in range(n):
		(p, c) = map(int, input().split())
		if T == True:
			if state == True:
				if p >= c:
					a = p
					b = c
				else:
					print('NO')
					T = False
				state = False
			elif p >= c and p >= a and (c >= b) and (p - a >= c - b):
				(a, b) = (p, c)
			else:
				print('NO')
				T = False
	if T == True:
		print('YES')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	(lp, lc) = (0, 0)
	ok = True
	for _ in range(n):
		(p, c) = map(int, input().split())
		if p < lp or c < lc or c > p:
			ok = False
		elif c > lc and p - lp < c - lc:
			ok = False
		(lp, lc) = (p, c)
	print('YES' if ok else 'NO')


import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(input())

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

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

def slv(N, PC):
	for (p, c) in PC:
		if p < c:
			return 'NO'
	for i in range(1, N):
		if not PC[i - 1][0] <= PC[i][0]:
			return 'NO'
		if not PC[i - 1][1] <= PC[i][1]:
			return 'NO'
		if not PC[i][1] - PC[i - 1][1] <= PC[i][0] - PC[i - 1][0]:
			return 'NO'
	return 'YES'

def main():
	T = read_int()
	for _ in range(T):
		N = read_int()
		PC = [read_int_n() for _ in range(N)]
		print(slv(N, PC))
main()


t = int(input())
for i in range(t):
	n = int(input())
	(play, clear) = map(int, input().split())
	flag = 0
	if play < clear:
		flag = 1
	for j in range(n - 1):
		(a, b) = map(int, input().split())
		if flag == 0:
			if a < play or b < clear:
				flag = 1
			elif a == play and b > clear:
				flag = 1
			elif a - play < b - clear:
				flag = 1
			else:
				play = a
				clear = b
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	(p, c) = (0, 0)
	flag = True
	for i in range(n):
		(a, b) = list(map(int, input().split()))
		if a < b or a < p or b < c or (a - b < p - c):
			flag = False
		(p, c) = (a, b)
	m = {True: 'YES', False: 'NO'}
	print(m[flag])


for i in range(int(input())):
	n = int(input())
	flag = 0
	(a, b) = (0, 0)
	for j in range(n):
		(p, c) = map(int, input().split())
		x = p - a
		y = c - b
		if x < y or c > p or x < 0 or (y < 0):
			flag = 1
		(a, b) = (p, c)
	if flag == 1:
		print('NO')
	else:
		print('YES')


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()
res = ['YES', 'NO']
for _ in range(ii()):
	f = 0
	p = c = 0
	for _ in range(ii()):
		(x, y) = mi()
		if x < p or y < c:
			f = 1
		elif y - c > x - p:
			f = 1
		(p, c) = (x, y)
		if p < c:
			f = 1
	print(res[f])


import math
from collections import defaultdict
t = 1
t = int(input())
for _ in range(t):
	n = int(input())
	ans = True
	(li, ci) = (0, 0)
	for _ in range(n):
		(l, c) = map(int, input().split())
		if l < li or c < ci or c - ci > l - li:
			ans = False
		li = l
		ci = c
	if ans:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	n = int(input())
	(pp, pc) = (0, 0)
	yes = True
	for i in range(n):
		(p, c) = [int(x) for x in input().split(' ')]
		if p - pp < 0 or c - pc < 0 or p - pp < c - pc:
			yes = False
		(pp, pc) = (p, c)
	if yes:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	flag = True
	(p, c) = map(int, input().split())
	if c > p:
		flag = False
	for j in range(n - 1):
		(q, w) = map(int, input().split())
		if w > q or p > q or c > w or (q - w < p - c):
			flag = False
		(p, c) = (q, w)
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
D = []

def fonction(M):
	if len(M) == 1:
		if M[0][0] >= M[0][1]:
			return 'YES'
		else:
			return 'NO'
	if M[0][0] < M[0][1]:
		return 'NO'
	else:
		test = True
		i = 0
		while test == True and i < len(M) - 1:
			test = M[i][0] <= M[i + 1][0] and any([M[i + 1][1] == M[i][1] + d for d in range(0, M[i + 1][0] - M[i][0] + 1)])
			i += 1
		if test == False:
			return 'NO'
		else:
			return 'YES'
for i in range(t):
	M = []
	n = int(input())
	for i in range(n):
		(p, c) = [int(x) for x in input().split()]
		M.append((p, c))
	D.append(M)
for k in D:
	print(fonction(k))


def f():
	n = int(input())
	pc = []
	for i in range(n):
		pc.append([int(s) for s in input().split()])
	(lastP, lastC) = (0, 0)
	for i in range(n):
		(p, c) = pc[i]
		if p < lastP:
			return 'NO'
		if c < lastC:
			return 'NO'
		if c - lastC > p - lastP:
			return 'NO'
		(lastP, lastC) = (p, c)
	return 'YES'
for t in range(int(input())):
	print(f())


t = int(input())
d = dict()
maxim = dif = 0
ans = True
for o in range(t):
	n = int(input())
	(a, b) = map(int, input().split())
	if b > a:
		ans = False
	for z in range(n - 1):
		(c, d) = map(int, input().split())
		if d > c:
			ans = False
		if ans == False:
			continue
		if c - a < d - b or d - b < 0 or c - a < 0:
			ans = False
			continue
		(a, b) = (c, d)
		c = d = 0
	if ans == True:
		print('YES')
	else:
		print('NO')
	ans = True


from math import *
from collections import *
from operator import itemgetter
import bisect
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
I = lambda : list(map(int, input().split()))
chrIdx = lambda x: ord(x) - 96
idxChr = lambda x: chr(96 + x)
t = ii()
for _ in range(t):
	n = ii()
	a = []
	for i in range(n):
		a.append(iia())
	flag = 'YES'
	if a[0][0] >= a[0][1]:
		flag = 'YES'
	else:
		flag = 'NO'
	for i in range(1, n):
		if a[i][0] < a[i - 1][0] or a[i][1] < a[i - 1][1] or a[i][0] - a[i - 1][0] < a[i][1] - a[i - 1][1]:
			flag = 'NO'
			break
	print(flag)


t = int(input())
for i in range(0, t):
	n = int(input())
	ans = 'YES'
	(p, c) = list(map(int, input().split(' ')))
	if c < 0 or p < c:
		ans = 'NO'
	for j in range(1, n):
		(p_, c_) = list(map(int, input().split(' ')))
		p_diff = p_ - p
		c_diff = c_ - c
		if c_diff < 0 or p_diff < 0 or p_diff < c_diff:
			ans = 'NO'
		p = p_
		c = c_
	print(ans)


import sys
import math
input = sys.stdin.readline
for _ in range(int(input())):
	k = int(input())
	f = False
	(n, m) = list(map(int, input().strip().split(' ')))
	if m > n:
		f = True
	for _ in range(k - 1):
		(a, b) = list(map(int, input().strip().split(' ')))
		if a < n:
			f = True
		if b > a:
			f = True
		if b < m or b - m > a - n:
			f = True
		n = a
		m = b
	print('NO' if f == 1 else 'YES')


t = int(input())
for _ in range(t):
	n = int(input())
	c = 1
	L = list(map(int, input().split()))
	if L[1] > L[0]:
		c = 0
	for i in range(n - 1):
		Li = list(map(int, input().split()))
		if c == 1:
			if Li[1] > Li[0]:
				c = 0
			d = Li[0] - L[0]
			di = Li[1] - L[1]
			if d < 0 or di < 0:
				c = 0
			if di > d:
				c = 0
			L = Li
	if c == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	pa = 0
	pb = 0
	flag = 0
	for i in range(0, n):
		(a, b) = map(int, input().split())
		if a >= pa and b >= pb:
			c = a - pa
			d = b - pb
			if c < 0 or d < 0:
				flag = 1
			elif c < d:
				flag = 1
			pa = a
			pb = b
		else:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	flag = 0
	temp = list(map(int, input().split()))
	if temp[1] > temp[0]:
		flag = 1
	for i in range(1, n):
		(x, y) = map(int, input().split())
		if x < temp[0] or y < temp[1] or y - temp[1] > x - temp[0] or (y > x):
			flag = 1
		temp = [x, y]
	if flag == 0:
		print('YES')
	else:
		print('NO')


k = int(input().strip())
for _ in range(k):
	n = int(input().strip())
	pp = pc = None
	no = False
	for _ in range(n):
		(p, c) = input().strip().split(' ')
		(p, c) = (int(p), int(c))
		if no:
			continue
		if p < c:
			no = True
		dp = p
		dc = c
		if pp is not None:
			dp -= pp
			dc -= pc
		if dp < 0 or dc < 0 or dc > dp:
			no = True
		(pp, pc) = (p, c)
	if no:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
import math
T = int(stdin.readline().rstrip())
for iTest in range(T):
	n = int(stdin.readline().rstrip())
	possible = True
	(pLast, cLast) = list(map(int, stdin.readline().rstrip().split(' ')))
	if pLast < cLast:
		possible = False
	for _ in range(n - 1):
		(p, c) = list(map(int, stdin.readline().rstrip().split(' ')))
		if p - pLast < c - cLast or pLast > p or cLast > c:
			possible = False
		(pLast, cLast) = (p, c)
	if possible:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	stats = []
	for j in range(n):
		stats += input().split()
	tries = int(stats[0])
	finished = int(stats[1])
	if finished > tries:
		print('NO')
		continue
	flag = True
	if n < 2:
		if int(stats[0]) >= int(stats[1]):
			print('YES')
		else:
			print('NO')
		continue
	for k in range(2, len(stats), 2):
		if int(stats[k]) - tries < int(stats[k + 1]) - finished or int(stats[k + 1]) > int(stats[k]) or int(stats[k + 1]) < finished:
			print('NO')
			flag = False
			break
		else:
			tries = int(stats[k])
			finished = int(stats[k + 1])
	if flag:
		print('YES')


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		ans = True
		aux_p = 0
		aux_c = 0
		for j in range(n):
			(p, c) = input().split()
			del_p = int(p) - aux_p
			del_c = int(c) - aux_c
			aux_p = int(p)
			aux_c = int(c)
			if del_p < 0 or del_c < 0:
				ans = False
			elif del_c > del_p:
				ans = False
		if ans:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	ok = 'YES'
	(prev_t, prev_c) = map(int, input().split())
	if prev_t < prev_c:
		ok = 'NO'
	for _ in range(n - 1):
		(cur_t, cur_c) = map(int, input().split())
		if cur_t < prev_t or cur_c < prev_c:
			ok = 'NO'
		elif cur_t < cur_c:
			ok = 'NO'
		elif cur_c - prev_c > cur_t - prev_t:
			ok = 'NO'
		(prev_t, prev_c) = (cur_t, cur_c)
	print(ok)


for t in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	f = 1
	for t1 in range(n):
		(p, c) = map(int, input().split())
		if p < a or c < b or p < c or (p - a < c - b):
			f = 0
		a = p
		b = c
	if f == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
while t:
	t -= 1
	tag = 1
	n = int(input())
	(p_last, c_last, cha_last) = (0, 0, 0)
	for i in range(n):
		(p, c) = list(map(int, input().split()))
		cha = p - c
		if tag and (p < p_last or c < c_last or c > p or (cha < cha_last)):
			tag = 0
		(p_last, c_last, cha_last) = (p, c, cha)
	if tag:
		print('YES')
	else:
		print('NO')


for qq in range(int(input())):
	(nt, nc) = (0, 0)
	cant = False
	for i in range(int(input())):
		(t, c) = map(int, input().split())
		if t < nt or c < nc:
			cant = True
		if t < c:
			cant = True
		if t - nt < c - nc:
			cant = True
		(nt, nc) = (t, c)
	print('YNEOS'[cant::2])


def check_pair(stats1, stats2):
	(plays1, clears1) = stats1
	(plays2, clears2) = stats2
	diff_plays = plays2 - plays1
	diff_clears = clears2 - clears1
	if 0 <= diff_clears <= diff_plays:
		return 1
	return 0
t = int(input())
for _ in range(t):
	correct = True
	stats = [(0, 0)]
	n = int(input())
	for _ in range(n):
		(plays, clears) = [int(i) for i in input().split()]
		stats.append((plays, clears))
	for i in range(n):
		if not check_pair(stats[i], stats[i + 1]):
			print('NO')
			correct = False
			break
	if correct:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	p1 = None
	c1 = None
	for j in range(n):
		(p, c) = input().split()
		(p, c) = (int(p), int(c))
		if p1 == None and c1 == None:
			(p1, c1) = (p, c)
		if p1 >= c1 and p >= c:
			if p >= p1 and c >= c1 and (p - p1 >= c - c1):
				ans = 'YES'
				(p1, c1) = (p, c)
			else:
				ans = 'NO'
				break
		else:
			ans = 'NO'
			break
	while j != n - 1:
		input().split()
		j = j + 1
	print(ans)


for _ in range(int(input())):
	arr = [[0, 0]]
	p = 'YES'
	n = int(input())
	for i in range(n):
		s = list(map(int, input().split()))
		if s[0] < s[1] or arr[-1][0] > s[0] or arr[-1][1] > s[1] or (s[1] - arr[-1][1] > s[0] - arr[-1][0]):
			p = 'NO'
		arr.append(s)
	print(p)


for i in range(int(input())):
	n = int(input())
	p_last = 0
	c_last = 0
	x = 0
	for j in range(n):
		(p, c) = map(int, input().split())
		if (p - p_last < 0 or p - p_last < c - c_last or c - c_last < 0) and x == 0:
			print('NO')
			x = x + 1
		else:
			p_last = p
			c_last = c
	if x == 0:
		print('YES')


t = int(input())
for i in range(t):
	lastp = 0
	lastc = 0
	ans = True
	n = int(input())
	for j in range(n):
		(p, c) = list(map(int, input().split()))
		if p < lastp:
			ans = False
		if c < lastc:
			ans = False
		if p < c:
			ans = False
		if p - lastp < c - lastc:
			ans = False
		lastc = c
		lastp = p
	print('YES') if ans else print('NO')


n = int(input())
for _ in range(n):
	t = int(input())
	(a, b) = (0, 0)
	cud_be = 'YES'
	for _ in range(t):
		(x, y) = map(int, input().split())
		if x - a < y - b or x - a < 0 or y - b < 0:
			cud_be = 'NO'
		(a, b) = (x, y)
	print(cud_be)


import sys
import math
from collections import Counter
from collections import OrderedDict
from functools import reduce
sys.setrecursionlimit(10 ** 6)

def inputt():
	return sys.stdin.readline().strip()

def printt(n):
	sys.stdout.write(str(n) + '\n')

def listt():
	return [int(i) for i in inputt().split()]

def gcd(a, b):
	return math.gcd(a, b)

def lcm(a, b):
	return a * b // gcd(a, b)

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def comb(n, k):
	factn = math.factorial(n)
	factk = math.factorial(k)
	fact = math.factorial(n - k)
	ans = factn // (factk * fact)
	return ans
t = int(inputt())
for _ in range(t):
	(du, dv) = (0, 0)
	c = 0
	n = int(inputt())
	li = []
	for _ in range(n):
		l = listt()
		li.append(l)
	for (i, j) in li:
		du = i - du
		dv = j - dv
		if du < 0 or dv < 0:
			print('NO')
			c = 1
			break
		elif du - dv < 0:
			print('NO')
			c = 1
			break
		du = i
		dv = j
	if c != 1:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	played = []
	cleared = []
	checker = 0
	for i in range(n):
		pc = input().split()
		played.append(int(pc[0]))
		cleared.append(int(pc[1]))
	if cleared[0] > played[0]:
		print('NO')
		checker = 1
	else:
		for i in range(1, n):
			if played[i] < played[i - 1] or cleared[i] < cleared[i - 1] or cleared[i] - cleared[i - 1] > played[i] - played[i - 1]:
				print('NO')
				checker = 1
				break
	if checker == 0:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	prevpi = 0
	prevci = 0
	flag = 0
	for _ in range(n):
		(m, n) = tuple(map(int, input().split(' ')))
		if m < prevpi or n < prevci:
			flag = 1
		if m - prevpi < n - prevci:
			flag = 1
		prevpi = m
		prevci = n
	if flag:
		print('NO')
	else:
		print('YES')


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : input()
t = ii()
for _ in range(t):
	x0 = 0
	y0 = 0
	n = ii()
	f = 0
	for __ in range(n):
		(x, y) = ml()
		if x < x0 or y < y0 or x < y or (y - y0 > x - x0):
			f = 1
		(x0, y0) = (x, y)
	if f:
		print('NO')
	else:
		print('YES')


tc = int(input())
for _ in range(tc):
	n = int(input())
	(lp, lc) = (0, 0)
	fail = False
	for _ in range(n):
		(p, c) = map(int, input().split())
		dp = p - lp
		dc = c - lc
		(lp, lc) = (p, c)
		if dp < dc or dc < 0:
			fail = True
	if fail:
		print('NO')
	else:
		print('YES')


T = int(input())
for _ in range(T):
	n = int(input())
	(last_p, last_c) = (0, 0)
	correct = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if c > p or p < last_p or c < last_c or (c - last_c > p - last_p):
			correct = False
		(last_p, last_c) = (p, c)
	if correct:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	b = True
	n = int(input())
	pp = 0
	pc = 0
	for j in range(n):
		(p, c) = map(int, input().split())
		if p >= pp and c >= pc and (p - pp >= c - pc):
			pp = p
			pc = c
		else:
			b = False
	if b:
		print('YES')
	else:
		print('NO')


T = int(input())
i = 0
while i < T:
	i += 1
	N = int(input())
	a = [[int(i) for i in input().split()] for j in range(N)]
	correct = True
	if N == 1:
		if a[0][0] < a[0][1]:
			correct = False
	else:
		for j in range(N - 1):
			if a[j][0] > a[j + 1][0] or a[j][1] > a[j + 1][1] or a[j + 1][0] - a[j][0] < a[j + 1][1] - a[j][1] or (a[j][0] < a[j][1]):
				correct = False
				break
	if correct == True:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	num = int(input())
	(lastx, lasty) = (0, 0)
	out = 'YES'
	for j in range(num):
		(nowx, nowy) = map(int, input().split())
		if nowy - lasty < 0 or nowx - lastx < 0:
			out = 'NO'
		if nowy - lasty > nowx - lastx:
			out = 'NO'
		(lastx, lasty) = (nowx, nowy)
	print(out)


t = int(input())
while t > 0:
	n = int(input())
	summ = 0
	lasta = 0
	lastb = 0
	arr = []
	for i in range(n):
		(a, b) = [int(i) for i in input().split()]
		arr.append((a, b))
	for i in range(n):
		(a, b) = arr[i]
		summ += b
		if a >= b and b - lastb <= a - lasta and (a >= lasta) and (b >= lastb):
			lastb = b
			lasta = a
		else:
			print('NO')
			break
	else:
		print('YES')
	t -= 1


import math
from collections import Counter
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
IN = lambda : input()

def s(a):
	print(' '.join(list(map(str, a))))
for i in range(I()):
	n = I()
	A = [[0, 0]]
	for i in range(n):
		(a, b) = M()
		A.append([a, b])
	k = 0
	for i in range(n):
		if A[i + 1][0] >= A[i][0] and A[i + 1][0] - A[i][0] + A[i][1] >= A[i + 1][1] and (A[i + 1][1] >= A[i][1]):
			continue
		else:
			k = 1
			break
	if k == 0:
		print('YES')
	else:
		print('NO')


def read():
	n = int(input())
	a = []
	for i in range(n):
		a.append(tuple(map(int, input().split())))
	return (n, a)

def solve(n, a):
	if not a[0][0] >= a[0][1]:
		return False
	for i in range(1, n):
		dp = a[i][0] - a[i - 1][0]
		dc = a[i][1] - a[i - 1][1]
		if dp < 0 or dc < 0 or dc > dp:
			return False
	return True
for i in range(int(input())):
	result = solve(*read())
	print('YES' if result else 'NO')


for _ in range(int(input())):
	n = int(input())
	p = []
	c = []
	possible = True
	for _ in range(n):
		(a, b) = list(map(int, input().split()))
		p.append(a)
		c.append(b)
		if b > a:
			possible = False
	for i in range(n - 1):
		if c[i + 1] < c[i] or p[i + 1] < p[i]:
			possible = False
		if c[i + 1] - c[i] > p[i + 1] - p[i]:
			possible = False
	print(['NO', 'YES'][possible])


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = []
	b = []
	for i in range(n):
		(x, y) = map(int, input().split())
		a += [x]
		b += [y]
	flag = 0
	if a[0] < b[0]:
		flag = 1
	else:
		for i in range(1, n):
			if a[i] < a[i - 1] or b[i] < b[i - 1] or a[i] < b[i] or (a[i] == a[i - 1] and b[i] > b[i - 1]) or (a[i] - a[i - 1] < b[i] - b[i - 1]):
				flag = 1
				break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for k in range(t):
	a = int(input())
	flag = True
	vet = []
	for r in range(a):
		(x, y) = list(map(int, input().split()))
		vet.append([x, y])
	if vet[0][1] > vet[0][0]:
		flag = False
	for i in range(1, len(vet)):
		pA = vet[i][0]
		pAA = vet[i - 1][0]
		cA = vet[i][1]
		cAA = vet[i - 1][1]
		if pA < pAA:
			flag = False
			break
		if cA < cAA:
			flag = False
			break
		if pA - pAA < cA - cAA:
			flag = False
			break
		if cA > pA:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


itr = int(input())
for _ in range(itr):
	n = int(input())
	prev = [0, 0]
	stats = []
	for i in range(n):
		stats.append(list(map(int, input().split())))
	for j in stats:
		if j[0] < prev[0] or j[1] < prev[1] or j[0] < j[1] or (j[1] - prev[1] > j[0] - prev[0]):
			ans = 'NO'
			break
		prev = j
	else:
		ans = 'YES'
	print(ans)


import math
import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	n = int(input())
	arr = []
	for j in range(n):
		arr.append(list(map(int, input().split())))
	flag = True
	for i in range(n - 1):
		if arr[i][1] > arr[i][0]:
			flag = False
			break
		if arr[i + 1][0] < arr[i][0] or arr[i + 1][1] < arr[i][1]:
			flag = False
			break
		if arr[i + 1][1] - arr[i][1] > arr[i + 1][0] - arr[i][0]:
			flag = False
			break
	if arr[n - 1][1] > arr[n - 1][0]:
		flag = False
	if flag:
		print('YES')
	else:
		print('NO')


def check(arr1, arr2):
	for i in range(len(arr1) - 1):
		if arr2[i + 1] - arr2[i] > arr1[i + 1] - arr1[i]:
			return True
	return False
for _ in range(int(input())):
	n = int(input())
	l = []
	s = []
	flag1 = flag = False
	for i in range(n):
		(a, b) = map(int, input().split())
		l.append(a)
		s.append(b)
		if a < b:
			flag1 = True
	flag = check(l, s) or l != sorted(l) or s != sorted(s)
	if flag or flag1:
		print('NO')
	else:
		print('YES')


import sys
I = sys.stdin.readline
ans = ''
for _ in range(int(I())):
	n = int(I().strip())
	flag = 1
	cc = 0
	cp = 0
	for i in range(n):
		(p, c) = map(int, I().split())
		if p - cp < 0 or c - cc < 0:
			flag = 0
		elif p - cp < c - cc:
			flag = 0
		elif c > p:
			flag = 0
		elif p - cp == 0 and c - cc > 0:
			flag = 0
		cc = c
		cp = p
	if flag:
		ans += 'YES\n'
	else:
		ans += 'NO\n'
print(ans)


for test in range(int(input())):
	n = int(input())
	l1 = []
	l2 = []
	pl1 = 0
	pl2 = 0
	c1 = c2 = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		l1.append(a)
		l2.append(b)
	for j in range(n):
		if j < 1:
			if l1[0] < l2[0]:
				print('NO')
				break
			else:
				c1 = c1 + 1
		else:
			d1 = l1[j] - l1[j - 1]
			d2 = l2[j] - l2[j - 1]
			if d1 >= 0 and d2 >= 0 and (d1 >= d2) and (l1[j] >= l2[j]):
				c1 = c1 + 1
			else:
				print('NO')
				break
	if c1 >= n:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	lastp = 0
	lastc = 0
	ck = True
	for __ in range(n):
		t = input()
		t = t.split(' ')
		p = int(t[0])
		c = int(t[1])
		if lastp > p:
			ck = False
		elif lastc > c:
			ck = False
		elif p - lastp < c - lastc:
			ck = False
		lastp = p
		lastc = c
	if ck:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	n = int(input())
	a = []
	b = []
	for i in range(n):
		(c, d) = map(int, input().split())
		a.append(c)
		b.append(d)
	f = False
	if n == 1:
		if a[0] >= b[0]:
			print('YES')
		else:
			print('NO')
	else:
		for i in range(n - 1):
			if (a[i] > a[i + 1] or b[i] > b[i + 1]) or (a[i + 1] == a[i] and b[i + 1] != b[i]) or a[i] < b[i] or (a[i + 1] - a[i] < b[i + 1] - b[i]):
				print('NO')
				f = True
				break
		if f == False:
			if a[-1] < b[-1]:
				print('NO')
			else:
				print('YES')


for t in range(int(input())):
	plays = 0
	clears = 0
	possible = True
	for n in range(int(input())):
		(p, c) = map(int, input().split())
		if p < plays:
			possible = False
		elif c < clears:
			possible = False
		elif c - clears > p - plays:
			possible = False
		plays = p
		clears = c
	if possible:
		print('YES')
	else:
		print('No')


t = int(input())
for k in range(t):
	n = int(input())
	arr = []
	for i in range(n):
		(p, c) = map(int, input().rstrip().split())
		arr.append([p, c])
	(p, c) = (arr[0][0], arr[0][1])
	count = True
	if p < c:
		print('NO')
		count = False
	else:
		for i in range(1, n):
			(k, m) = (arr[i][0], arr[i][1])
			if k < p or m < c or k < m or (k - p < m - c):
				print('NO')
				count = False
				break
			(p, c) = (k, m)
	if count == True:
		print('YES')


t = int(input())
for wer in range(t):
	n = int(input())
	p = []
	c = []
	for i in range(n):
		(pi, ci) = map(int, input().split())
		p.append(pi)
		c.append(ci)
	if p[0] < c[0]:
		print('NO')
		continue
	for i in range(1, n):
		if p[i] < p[i - 1] + c[i] - c[i - 1] or c[i] < c[i - 1] or c[i] > p[i]:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = c = pa = pc = j = 0
	test = True
	while test and j < n:
		f = lambda : map(int, input().split())
		(a, c) = f()
		if c < pc or a < pa or a < c or (c - pc > a - pa):
			test = False
		j += 1
		pc = c
		pa = a
	for k in range(n - j):
		f = lambda : map(int, input().split())
		(a, c) = f()
	if test:
		print('YES')
	else:
		print('NO')


def iscorrect(List):
	l = len(List)
	for i in range(l - 1):
		a1 = List[i][0]
		b1 = List[i][1]
		a2 = List[i + 1][0]
		b2 = List[i + 1][1]
		if a1 > a2 or b1 > b2 or a1 < b1:
			return False
		elif a2 - a1 < b2 - b1:
			return False
	else:
		return True
t = int(input())
for i in range(t):
	n = int(input())
	List = []
	for i in range(n):
		ab = list(map(int, input().rstrip().split()))
		List += [ab]
	if n == 1:
		if List[0][0] >= List[0][1]:
			print('YES')
		else:
			print('NO')
	else:
		print('YES' if iscorrect(List) else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	stat = [tuple(map(int, input().split())) for _ in range(n)]
	prev_p = 0
	prev_c = 0
	for (p, c) in stat:
		if p < prev_p or c < prev_c or p < c or (p - c < prev_p - prev_c):
			print('NO')
			break
		prev_p = p
		prev_c = c
	else:
		print('YES')


t = int(input())
for j in range(t):
	n = int(input())
	i = 0
	p1 = 0
	c1 = 0
	q = 0
	while i < n:
		(p, c) = map(int, input().split())
		if p >= p1 and c >= c1 and (p - p1 >= c - c1):
			i += 1
			p1 = p
			c1 = c
		else:
			q = 1
			i += 1
	if q == 0:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	flag = 0
	n = int(input())
	p = []
	c = []
	for j in range(n):
		(x, y) = list(map(int, input().split()))
		p.append(x)
		c.append(y)
	if p[0] < c[0]:
		print('NO')
		continue
	for j in range(1, n):
		if p[j] < p[j - 1]:
			print('NO')
			flag = 1
			break
		elif c[j] < c[j - 1]:
			print('NO')
			flag = 1
			break
		elif p[j] - p[j - 1] < c[j] - c[j - 1]:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


def solve(peeks):
	max_plays = 0
	max_clears = 0
	for (play, clear) in peeks:
		play_change = play - max_plays
		clear_change = clear - max_clears
		if play_change < 0 or clear_change < 0:
			return 'NO'
		if clear_change > play_change:
			return 'NO'
		max_plays = play
		max_clears = clear
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	peeks = []
	for i in range(n):
		(plays, clears) = map(int, input().split(' '))
		peeks.append([plays, clears])
	print(solve(peeks))


def checklevel(a):
	currp = 0
	currc = 0
	for i in a:
		if currp > i[0]:
			return 'NO'
		if currc > i[1]:
			return 'NO'
		if i[1] - currc > i[0] - currp:
			return 'NO'
		currp = i[0]
		currc = i[1]
	return 'YES'
cases = int(input())
for _ in range(cases):
	l = int(input())
	a = []
	for _ in range(l):
		a.append(list(map(int, input().split())))
	print(checklevel(a))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	(a, b) = (-1, -1)
	ans = 'YES'
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < a or c < min(b, b - a + p) or c > p - a + b:
			ans = 'NO'
		else:
			a = p
			b = c
	print(ans)


from math import *
for t in range(int(input())):
	n = int(input())
	prevp = 0
	prevc = 0
	prevlos = 0
	f = True
	for i in range(n):
		(p, c) = map(int, input().split())
		los = p - c
		if (c > p or p < prevp or c < prevc) or los < prevlos:
			f = False
		prevc = c
		prevp = p
		prevlos = los
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	n = int(input())
	stats = []
	for i in range(n):
		stats.append([int(x) for x in input().split()])
	if stats[0][0] < stats[0][1]:
		print('NO')
		continue
	f = 0
	for i in range(1, n):
		x = stats[i][0] - stats[i - 1][0]
		if x < 0:
			f = 1
			break
		else:
			y = stats[i][1] - stats[i - 1][1]
			if x < y or y < 0:
				f = 1
				break
	if f == 1:
		print('NO')
	else:
		print('YES')


T = int(input())
for i in range(T):
	x = int(input())
	prev = list(map(int, input().split()))
	works = True
	if prev[1] > prev[0]:
		works = False
	for j in range(x - 1):
		n = list(map(int, input().split()))
		if n[0] >= prev[0] and n[1] >= prev[1] and (n[1] - prev[1] <= n[0] - prev[0]):
			prev = n[:]
		else:
			works = False
	if works:
		print('YES')
	else:
		print('NO')


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
for _ in range(int(input())):
	n = int(input())
	pprev = 0
	cprev = 0
	ans = 'YES'
	for inps in range(n):
		(p, c) = map(int, input().split())
		if p < c:
			ans = 'NO'
		diffp = p - pprev
		diffc = c - cprev
		if diffp < 0 or diffc < 0 or diffp < diffc:
			ans = 'NO'
		pprev = p
		cprev = c
	print(ans)


import sys
from statistics import mean
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for i in range(t):
	n = inp()
	flag = 1
	x = None
	y = None
	for j in range(n):
		(a, b) = invr()
		if b > a:
			flag = 0
			continue
		if flag == 0:
			continue
		elif flag == 1:
			if x is None and y is None:
				x = a
				y = b
			else:
				m = a - x
				n = b - y
				if m < 0 or n < 0 or n > m:
					flag = 0
				else:
					x = a
					y = b
	if flag == 1:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
T = int(input())
for t in range(T):
	N = int(input())
	p = [tuple(map(int, input().split())) for i in range(N)]
	poss = p[0][0] >= p[0][1]
	for i in range(N - 1):
		(dx, dy) = (p[i + 1][0] - p[i][0], p[i + 1][1] - p[i][1])
		if not (dx >= dy and dy >= 0):
			poss = False
			break
	print('YES' if poss else 'NO')


def is_valid_sequence(sequence):
	prev_attempts = prev_successful_attempts = 0
	for (attempts, successful_attempts) in sequence:
		if successful_attempts > attempts or attempts < prev_attempts or successful_attempts < prev_successful_attempts or (attempts - prev_attempts < abs(successful_attempts - prev_successful_attempts)):
			return 'NO'
		(prev_attempts, prev_successful_attempts) = (attempts, successful_attempts)
	return 'YES'
sequence_of_attempts = []
for _ in range(int(input())):
	attempts = []
	for _ in range(int(input())):
		attempts.append([int(s) for s in input().split()])
	sequence_of_attempts.append(attempts)
results = [is_valid_sequence(s) for s in sequence_of_attempts]
print('\n'.join(results))


import sys
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 998244353
for _ in range(int(ri())):
	n = int(ri())
	maxc = -1
	maxp = -1
	(maxp, maxc) = Ri()
	flag = True
	if maxc > maxp:
		flag = False
	for i in range(1, n):
		(a, b) = Ri()
		if a < maxp:
			flag = False
		if b < maxc:
			flag = False
		if b > a:
			flag = False
		if a - maxp < b - maxc:
			flag = False
		maxp = a
		maxc = b
	if flag:
		YES()
	else:
		NO()


for _ in range(0, int(input())):
	n = int(input())
	p = []
	c = []
	for x in range(0, n):
		pc = list(map(int, input().split()))
		p.append(pc[0])
		c.append(pc[1])
	flag = 0
	if c[0] > p[0]:
		print('NO')
	else:
		for i in range(1, n):
			if p[i] - p[i - 1] < 0:
				flag = 1
				print('NO')
				break
			if c[i] - c[i - 1] < 0:
				flag = 1
				print('NO')
				break
			if c[i] - c[i - 1] > p[i] - p[i - 1]:
				flag = 1
				print('NO')
				break
		if flag == 0:
			print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	bef_c = 0
	bef_p = 0
	possible = 1
	for i in range(n):
		(p, c) = map(int, input().split())
		if bef_p > p:
			possible = 0
		elif bef_c > c:
			possible = 0
		elif p - bef_p < c - bef_c:
			possible = 0
		bef_p = p
		bef_c = c
	if possible:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(v, z, x) = ([], 0, 0)
	for _ in range(int(input())):
		(q, w) = map(int, input().split())
		v.append([q, w])
	for i in range(len(v)):
		(r, t) = (v[i][0], v[i][1])
		if r >= t:
			if r - z < t - x:
				z = -1
				break
			if r >= z and x == t:
				(z, x) = (r, t)
			elif r > z and t > x:
				(z, x) = (r, t)
			else:
				z = -1
				break
		else:
			z = -1
			break
	if z == -1:
		print('NO')
	else:
		print('YES')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')

def main():
	for _ in range(N()):
		n = N()
		(lp, lc) = (-1, -1)
		res = True
		for i in range(n):
			(np, nc) = RL()
			if np == lp and nc > lc or np < lp or nc < lc or (nc - lc > np - lp):
				res = False
			(lp, lc) = (np, nc)
		if res == False:
			print('NO')
		else:
			print('YES')
main()


def Polycarp():
	n = int(input())
	p = []
	c = []
	for i in range(n):
		(pNew, cNew) = list(map(int, input().split()))
		p.append(pNew)
		c.append(cNew)
	for j in range(n):
		if c[j] > p[j]:
			print('NO')
			return
		if j >= 1:
			if c[j] < c[j - 1]:
				print('NO')
				return
			elif p[j] < p[j - 1]:
				print('NO')
				return
			elif p[j] - p[j - 1] < c[j] - c[j - 1]:
				print('NO')
				return
	print('YES')
	return
t = int(input())
for i in range(t):
	Polycarp()


t = int(input())
while t:
	n = int(input())
	(x, y) = (0, 0)
	f = 1
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < x or c < y or p - x < c - y:
			f = 0
		x = p
		y = c
	if f:
		print('YES')
	else:
		print('NO')
	t = t - 1


for i in range(int(input())):
	ce = []
	pe = []
	for _ in range(int(input())):
		(c, p) = [int(e) for e in input().split()]
		ce.append(c)
		pe.append(p)
	wynik = True
	if ce[0] < pe[0]:
		wynik = False
	for i in range(1, len(ce)):
		if pe[i] < pe[i - 1] or ce[i] < ce[i - 1] or pe[i] - pe[i - 1] > ce[i] - ce[i - 1]:
			wynik = False
	print(('NO', 'YES')[wynik])


t = int(input())
while t:
	t = t - 1
	n = int(input())
	pair = list()
	arr = list()
	m = n
	flag = 1
	while n:
		n = n - 1
		pair = input().split()
		arr.append(pair)
	if int(arr[0][0]) < int(arr[0][1]):
		flag = 0
	for i in range(1, m, 1):
		if int(arr[i][0]) < int(arr[i - 1][0]):
			flag = 0
		if int(arr[i][1]) < int(arr[i - 1][1]):
			flag = 0
		if int(arr[i][0]) == int(arr[i - 1][0]):
			if int(arr[i][1]) > int(arr[i - 1][1]):
				flag = 0
		if int(arr[i][0]) < int(arr[i][1]):
			flag = 0
		if int(arr[i][0]) - int(arr[i - 1][0]) < int(arr[i][1]) - int(arr[i - 1][1]):
			flag = 0
	if flag:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
from collections import *
T = int(input())
for _ in range(T):
	n = int(input())
	(pp, pc) = (0, 0)
	flag = True
	for _ in range(n):
		(p, c) = map(int, input().split())
		if p == pp:
			if c > pc or c < pc:
				flag = False
		elif p < pp:
			flag = False
		else:
			if c < pc:
				flag = False
			if c - pc > p - pp:
				flag = False
		(pp, pc) = (p, c)
	if flag:
		print('YES')
	else:
		print('NO')


import sys
from itertools import islice
stdin = sys.stdin
T = stdin.readline()
T = int(T)

def solve(data):
	prev_p = prev_c = 0
	for (p, c) in data:
		if p < prev_p or c < prev_c:
			return 'NO'
		if c - prev_c > p - prev_p:
			return 'NO'
		prev_p = p
		prev_c = c
	return 'YES'
for test_idx in range(T):
	n = stdin.readline()
	n = int(n)
	data = [[int(y) for y in x.split()] for x in islice(stdin, n)]
	result = solve(data)
	print(result)


def p(lst, ind):
	lst = lst[ind].split(' ')
	p = lst[0]
	return int(p)

def c(lst, ind):
	lst = lst[ind].split(' ')
	c = lst[1]
	return int(c)
t = int(input())
for i in range(t):
	n = int(input())
	lst = []
	for j in range(n):
		p_c = input()
		lst.append(p_c)
	for k in range(n - 1):
		if p(lst, k) == p(lst, k + 1) and c(lst, k) != c(lst, k + 1) or p(lst, k + 1) - p(lst, k) < c(lst, k + 1) - c(lst, k):
			print('NO')
			break
		elif c(lst, k + 1) <= p(lst, k + 1) >= p(lst, k) >= c(lst, k) <= c(lst, k + 1):
			continue
		else:
			print('NO')
			break
	else:
		if n == 1 and p(lst, 0) < c(lst, 0):
			print('NO')
		else:
			print('YES')


for j in range(int(input())):
	(a, b) = (0, 0)
	ans = 1
	for i in range(int(input())):
		(c, d) = map(int, input().split())
		if c - a < d - b or min(c - a, d - b) < 0:
			ans = 0
		(a, b) = (c, d)
	if ans == 1:
		print('YES')
	else:
		print('NO')


T = int(input())
for case in range(T):
	peeks = int(input())
	flag = False
	lasta = 0
	lastc = 0
	for p in range(peeks):
		(a, c) = [int(x) for x in input().split()]
		if c > a:
			flag = True
		elif a - c < lasta - lastc:
			flag = True
		elif a < lasta or c < lastc:
			flag = True
		lasta = a
		lastc = c
	if flag:
		print('NO')
	else:
		print('YES')


import collections, math, bisect, re
local = False
if local:
	file = open('input.txt', 'r')
	import time

def inp():
	if local:
		return file.readline().rstrip()
	else:
		return input().rstrip()

def ints():
	return [int(_) for _ in inp().split()]
if local:
	start = time.time()
t = int(inp())
for _ in range(1, t + 1):
	n = int(inp())
	pairs = [0] * n
	for i in range(n):
		pairs[i] = ints()
	problem = pairs[0][1] > pairs[0][0]
	for i in range(1, n):
		(prevP, prevC) = pairs[i - 1]
		(curP, curC) = pairs[i]
		if prevP < prevC or curP < curC or curP < prevP or (curC < prevC) or (curP - prevP < curC - prevC):
			problem = True
			break
	if problem:
		print('NO')
	else:
		print('YES')
if local:
	fin = (time.time() - start) * 1000
	print('{:.2f}'.format(fin) + 'ms')


def main():
	n = int(input())
	(pl, cl) = (0, 0)
	correct = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if c - cl > p - pl:
			correct = False
		if c < cl:
			correct = False
		if p < pl:
			correct = False
		(pl, cl) = (p, c)
	if correct:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	main()


t = int(input())
for i in range(t):
	n = int(input())
	x = []
	for j in range(n):
		a = list(map(int, input().split()))
		x.append(a)
	flag = 'YES'
	if n == 1:
		if x[0][1] > x[0][0]:
			flag = 'NO'
		print(flag)
	else:
		for j in range(len(x) - 1):
			if (x[j + 1][0] < x[j][0] or x[j + 1][0] < x[j + 1][1]) or (x[j + 1][1] < x[j][1] or x[j][0] < x[j][1]):
				flag = 'NO'
				break
			if x[j + 1][0] == x[j][0] and x[j + 1][1] != x[j][1]:
				flag = 'NO'
				break
			r = x[j + 1][0] - x[j][0]
			if x[j + 1][1] - x[j][1] > r:
				flag = 'NO'
				break
		print(flag)


for _ in range(int(input())):
	n = int(input())
	p = []
	c = []
	for i in range(n):
		(P, C) = map(int, input().split())
		p.append(P)
		c.append(C)
	flag = True
	if p[0] < c[0]:
		flag = False
	else:
		for i in range(1, n):
			if p[i] < c[i]:
				flag = False
				break
			if c[i] < c[i - 1]:
				flag = False
				break
			if p[i] < p[i - 1]:
				flag = False
				break
			if p[i] == p[i - 1]:
				if c[i] == c[i - 1]:
					continue
				flag = False
				break
			if p[i] > p[i - 1]:
				if p[i] - p[i - 1] < c[i] - c[i - 1]:
					flag = False
					break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = []
	ans = 'yes'
	for i in range(n):
		(x, y) = map(int, input().split())
		l.append((x, y))
		if y > x:
			ans = 'no'
		if i == 0 or ans == 'no':
			continue
		t = l[i][0] - l[i - 1][0]
		c = l[i][1] - l[i - 1][1]
		if c > t or c < 0 or t < 0:
			ans = 'no'
	print(ans)


import os
from io import BytesIO
input = BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
for _ in range(t):
	n = int(input())
	pp = 0
	pc = 0
	possible = True
	for i in range(n):
		(pi, ci) = list(map(int, input().split()))
		newp = pi - pp
		newc = ci - pc
		if pi < pp or ci < pc or newc > newp:
			possible = False
		pp = pi
		pc = ci
	if possible:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	l = []
	ans = 'YES'
	(prev_p, prev_c) = (0, 0)
	for i in range(n):
		(p, c) = map(int, input().split())
		if c > p:
			ans = 'NO'
		if p < prev_p or c < prev_c:
			ans = 'NO'
		if c - prev_c > p - prev_p:
			ans = 'NO'
		(prev_p, prev_c) = (p, c)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	f = 0
	arr = [int(0) for i in range(n)]
	for i in range(n):
		(p, c) = map(int, input().split())
		arr[i] = [p, c]
	if arr[0][0] >= arr[0][1]:
		for i in range(1, n):
			if arr[i][1] < arr[i - 1][1] or arr[i][0] < arr[i - 1][0]:
				f += 1
				print('NO')
				break
			elif arr[i][1] - arr[i - 1][1] > arr[i][0] - arr[i - 1][0]:
				f += 1
				print('NO')
				break
		if f == 0:
			print('YES')
	else:
		print('NO')


def solution():
	from sys import stdout, stdin
	(_input, _print) = (stdin.readline, stdout.write)
	for _ in range(int(_input())):
		n = int(input())
		f = False
		for i in range(n):
			(p, c) = [int(i) for i in input().split()]
			if i == 0:
				(oldp, oldc) = (p, c)
				if p < c:
					f = True
			elif oldp > p or oldc > c:
				f = True
			elif p - oldp < c - oldc:
				f = True
			(oldp, oldc) = (p, c)
		if f:
			print('NO')
		else:
			print('YES')
solution()


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	N = int(input())
	AB = [list(map(int, input().split())) for _ in range(N)]
	Query.append((N, AB))
for (N, AB) in Query:
	ok = True
	pa = 0
	pb = 0
	for (a, b) in AB:
		da = a - pa
		db = b - pb
		if da < 0 or db < 0 or db > da:
			ok = False
			break
		pa = a
		pb = b
	print('YES' if ok else 'NO')


import sys
input = sys.stdin.readline
from collections import Counter

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def print_list_int(l):
	print(''.join(map(str, map(int, l))))
t = inp()
for test in range(t):
	n = inp()
	peeks = []
	last = (-1, -1)
	possible = True
	for i in range(n):
		(p_old, c_old) = last
		(p, c) = inlt()
		if p < p_old or c < c_old or p - p_old < c - c_old:
			possible = False
		last = (p, c)
	if possible:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	ans = '-'
	n = int(input())
	arr = []
	for i in range(n):
		(u, v) = [int(c) for c in input().split()]
		if v > u or v < 0 or u < 0:
			ans = 'NO'
		arr.append((u, v))
	if ans != '-':
		print(ans)
	else:
		for i in range(1, n):
			if arr[i][0] < arr[i - 1][0] or arr[i][1] < arr[i - 1][1]:
				print('NO')
				break
			elif arr[i][0] - arr[i - 1][0] < arr[i][1] - arr[i - 1][1]:
				print('NO')
				break
		else:
			print('YES')


from sys import stdin, stdout
from collections import defaultdict
import heapq

def get_int():
	return int(stdin.readline().strip())

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_string():
	return stdin.readline().strip()
INF = 10000000000.0
for _ in range(int(stdin.readline())):
	n = get_int()
	px = 0
	py = 0
	flag = True
	for i in range(n):
		(x, y) = get_ints()
		if x < px or y < py or y - py > x - px:
			flag = False
		(px, py) = (x, y)
	if flag:
		print('YES')
	else:
		print('NO')


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	(x, y) = (0, 0)
	flag = 1
	for i in range(n):
		(p, c) = map(int, sys.stdin.readline().split())
		if not (p >= c and p >= x and (c >= y)):
			flag = 0
		if p - x < c - y:
			flag = 0
		x = p
		y = c
	if flag == 0:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	f = 1
	x = -1
	y = -1
	for i in range(n):
		(x1, y1) = map(int, stdin.readline().split())
		if y1 > x1:
			f = 0
		if x != -1:
			dx = x1 - x
			dy = y1 - y
			if dx < 0 or dy < 0:
				f = 0
			if dy > dx:
				f = 0
		(x, y) = (x1, y1)
	stdout.write('YES\n' if f else 'NO\n')


def solve(n):
	no = False
	(pi, ci) = (0, 0)
	for _ in range(n):
		(p, c) = map(int, input().split())
		p_delta = p - pi
		c_delta = c - ci
		(pi, ci) = (p, c)
		if c_delta > p_delta or c_delta < 0 or p_delta < 0:
			no = True
	print('NO' if no else 'YES')
	return
q = int(input())
while q:
	q -= 1
	solve(int(input()))


T = int(input().strip())
for t in range(T):
	n = int(input().strip())
	p = []
	c = []
	for i in range(n):
		(_p, _c) = map(int, input().strip().split())
		p.append(_p)
		c.append(_c)
	if any((pi < ci for (pi, ci) in zip(p, c))):
		print('NO')
	elif any((p[i - 1] > p[i] for i in range(1, n))):
		print('NO')
	elif any((c[i - 1] > c[i] for i in range(1, n))):
		print('NO')
	elif any((p[i] - p[i - 1] < c[i] - c[i - 1] for i in range(1, n))):
		print('NO')
	else:
		print('YES')


t = int(input())
while t > 0:
	n = int(input())
	L = []
	for i in range(n):
		L.append(list(map(int, input().split())))
	p = True
	for i in range(n - 1):
		if L[i + 1][0] < L[i][0] or L[i + 1][1] < L[i][1]:
			p = False
			break
		if L[i + 1][1] - L[i][1] > L[i + 1][0] - L[i][0]:
			p = False
			break
		if L[i][0] < L[i][1]:
			p = False
	if L[n - 1][0] < L[n - 1][1]:
		p = False
	if p:
		print('YES')
	else:
		print('NO')
	t -= 1


for t in range(int(input())):
	n = int(input())
	ans = 'YES'
	pOld = 0
	cOld = 0
	for _ in range(n):
		(p, c) = map(int, input().split())
		if p - pOld < 0 or c - cOld < 0 or c - cOld > p - pOld:
			ans = 'NO'
		pOld = p
		cOld = c
	print(ans)


import sys
MAX_INT = 2 ** 62 - 1
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

def read_n_int() -> list:
	return list(map(int, input().split()))

def read_int() -> int:
	return int(input())

def main():
	t = read_int()
	for _ in range(t):
		n = int(input())
		(pre_p, pre_c) = (0, 0)
		res = False
		for _ in range(n):
			(p, c) = map(int, input().split())
			if not res and (p - pre_p < c - pre_c or p < pre_p or c < pre_c):
				res = True
			(pre_p, pre_c) = (p, c)
		print('YES' if not res else 'NO')
main()


from collections import Counter, defaultdict, deque
from math import *
import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	(p, c) = [int(x) for x in input().split()]
	fail = False
	if p < c:
		fail = True
	p0 = p
	c0 = c
	for i in range(1, n):
		(p, c) = [int(x) for x in input().split()]
		dc = c - c0
		dp = p - p0
		if dc < 0 or p0 < 0 or dp < dc:
			fail = True
		p0 = p
		c0 = c
	if fail:
		print('NO')
	else:
		print('YES')
tt = int(input())
for test in range(tt):
	solve()


for k in range(int(input())):
	n1 = int(input())
	f = True
	x = 0
	y = 0
	for i in range(n1):
		(a, b) = map(int, input().split())
		if a < x or b < y or a - x < b - y:
			f = False
		x = a
		y = b
	if f == 1:
		print('YES')
	else:
		print('NO')


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	n = int(input())
	a = []
	l1 = 0
	l2 = 0
	f1 = 1
	pf = []
	for i in range(n):
		(x, y) = mapi()
		if not (x >= l1 and y >= l2 and (x - l1 >= y - l2)):
			f1 = 0
		l1 = max(l1, x)
		l2 = max(l2, y)
	if f1:
		print('YES')
	else:
		print('NO')


T = int(input())
for j in range(0, T):
	n = int(input())
	p = []
	c = []
	exist = 'YES'
	for i in range(0, n):
		(pi, ci) = input().split()
		p.append(int(pi))
		c.append(int(ci))
		if p[i] < c[i]:
			exist = 'NO'
		if i > 0 and p[i] < p[i - 1]:
			exist = 'NO'
		if i > 0 and c[i] < c[i - 1]:
			exist = 'NO'
		if i > 0 and p[i] - p[i - 1] < c[i] - c[i - 1]:
			exist = 'NO'
	print(exist)


tests = int(input())
for i in range(tests):
	n = int(input())
	ps = 0
	cs = 0
	resultado = 'YES'
	for i in range(n):
		(p, c) = [int(i) for i in input().split()]
		if (p < ps) | (c < cs) | (c - cs > p - ps):
			resultado = 'NO'
		(ps, cs) = (p, c)
	print(resultado)


def main():
	t = int(input())
	for turn in range(1, t + 1):
		n = int(input())
		stats = []
		last_p = 0
		last_c = 0
		prop = True
		for nth in range(1, n + 1):
			x = input().split(' ')
			x[0] = int(x[0])
			x[1] = int(x[1])
			stats.append(x)
			if x[0] < last_p or x[1] < last_c:
				prop = False
			if x[0] < x[1]:
				prop = False
			if x[1] - last_c > x[0] - last_p:
				prop = False
			last_p = x[0]
			last_c = x[1]
		if prop:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	(p, c) = ([], [])
	for i in range(n):
		(a, b) = map(int, input().split())
		p.append(a)
		c.append(b)
	(exisp, exisc) = (0, 0)
	ans = True
	for i in range(n):
		if p[i] < exisp:
			ans = False
			break
		if c[i] < exisc:
			ans = False
			break
		if c[i] > p[i]:
			ans = False
			break
		if p[i] - exisp < c[i] - exisc:
			ans = False
			break
		exisc = c[i]
		exisp = p[i]
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	for m in range(n):
		arr += [list(map(int, input().split()))]
	flag = 1
	for i in range(n):
		if i != 0:
			if arr[i][0] < arr[i][1] or arr[i][0] < arr[i - 1][0] or arr[i][1] < arr[i - 1][1] or (arr[i][0] - arr[i - 1][0] < arr[i][1] - arr[i - 1][1]):
				print('NO')
				flag = 0
				break
		elif arr[i][0] < arr[i][1]:
			print('NO')
			flag = 0
			break
	if flag:
		print('YES')


tc = int(input(''))
while tc > 0:
	n = int(input(''))
	p = 0
	c = 0
	stats = True
	for i in range(n):
		(x, y) = input('').split()
		if int(x) < p or int(y) < c or int(y) - c > int(x) - p:
			stats = False
		p = int(x)
		c = int(y)
	if stats:
		print('Yes')
	else:
		print('No')
	tc -= 1


def solve(play, clear, n):
	if play[0] < clear[0]:
		return 'NO'
	for i in range(1, n):
		if play[i] < play[i - 1] or clear[i] < clear[i - 1] or play[i] < clear[i] or (play[i] - play[i - 1] < clear[i] - clear[i - 1]):
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	play = [0] * n
	clear = [0] * n
	for i in range(n):
		(play[i], clear[i]) = map(int, input().split())
	print(solve(play, clear, n))


T = int(input())
for t in range(T):
	N = int(input())
	arrP = []
	arrC = []
	for n in range(N):
		(p, c) = input().split(' ')
		arrP.append(int(p))
		arrC.append(int(c))
	if arrP[0] < arrC[0]:
		print('NO')
	else:
		flag = True
		for n in range(1, N):
			if arrP[n] < arrC[n] or arrP[n] < arrP[n - 1] or arrC[n] < arrC[n - 1] or (arrP[n] - arrP[n - 1] < arrC[n] - arrC[n - 1]):
				flag = False
				print('NO')
				break
		if flag:
			print('YES')


for _ in range(int(input())):
	n = int(input())
	a = []
	for _ in range(n):
		a.append(list(map(int, input().split())))
	(c, d, f) = (0, 0, 0)
	for i in range(n):
		if a[i][0] - c < a[i][1] - d or c > a[i][0] or d > a[i][1]:
			f = 1
			break
		c = a[i][0]
		d = a[i][1]
	if f == 1:
		print('NO')
	else:
		print('YES')


def read_int():
	return int(input().strip())

def read_ints():
	return list(map(int, input().strip().split(' ')))

def solve():
	n = read_int()
	min_diff = 0
	(p, c) = ([0], [0])
	for _ in range(n):
		(a, b) = read_ints()
		p.append(a)
		c.append(b)
	for i in range(1, n + 1):
		if p[i] - c[i] < min_diff:
			return 'NO'
		min_diff = p[i] - c[i]
		if p[i] < p[i - 1] or c[i] < c[i - 1]:
			return 'NO'
		if c[i] > p[i]:
			return 'NO'
	return 'YES'
T = read_int()
for _ in range(T):
	print(solve())


t = int(input())
for _ in range(t):
	n = int(input())
	(max_p, max_c) = (0, 0)
	check = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if check and (p < max_p or c < max_c or c > p or (max_p + c - max_c > p)):
			check = False
			continue
		(max_p, max_c) = (p, c)
	if check:
		print('Yes')
		continue
	print('No')


ANS = ''

def yesno(a):
	global ANS
	if a == 1:
		ANS += 'YES'
	else:
		ANS += 'NO'
	ANS += '\n'
for i in range(int(input())):
	n = int(input())
	ans = 1
	arr = []
	for i in range(n):
		arr.append([int(s) for s in input().split()])
	if arr[0][0] < arr[0][1]:
		ans = 0
	for i in range(1, n):
		if arr[i][0] < arr[i - 1][0]:
			ans = 0
		if arr[i][1] < arr[i - 1][1]:
			ans = 0
		if arr[i][0] - arr[i][1] < arr[i - 1][0] - arr[i - 1][1]:
			ans = 0
		if arr[i][0] < arr[i][1]:
			ans = 0
	yesno(ans)
print(ANS)


t = int(input())
for _ in range(t):
	n = int(input())
	pc = []
	for _2 in range(n):
		pc.append(tuple(map(int, input().split())))
	p = [p for (p, c) in pc]
	c = [c for (p, c) in pc]
	dp = [p_i - p_j for (p_j, p_i) in zip(p[:-1], p[1:])]
	dc = [p_i - p_j for (p_j, p_i) in zip(c[:-1], c[1:])]
	if any((d < 0 for d in dp)):
		print('NO')
	elif any((d < 0 for d in dc)):
		print('NO')
	elif any((d_c > d_p for (d_c, d_p) in zip(dc, dp))):
		print('NO')
	elif any((c > p for (p, c) in pc)):
		print('NO')
	else:
		print('YES')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	A = []
	for i in range(n):
		(p, c) = map(int, input().split(' '))
		A.append([p, c])
	clr = True
	(p, c) = (A[0][0], A[0][1])
	if c > p:
		clr = False
	for i in range(1, n):
		if A[i][0] < p or A[i][1] < c or A[i][0] < A[i][1] or (A[i][1] - c > A[i][0] - p):
			clr = False
			break
		(p, c) = (A[i][0], A[i][1])
	if clr:
		print('YES')
	else:
		print('NO')


import sys
input = lambda : sys.stdin.readline().strip()
ipnut = input

def ch(a):
	return a ** 0.5 == int(a ** 0.5)
for i in range(int(input())):
	n = int(ipnut())
	f = True
	(tt, tk) = (0, 0)
	for i in range(n):
		(t, k) = map(int, input().split())
		if t < tt or k < tk:
			f = False
		dt = t - tt
		dk = k - tk
		if dt < dk:
			f = False
		tt = t
		tk = k
	if f:
		print('YES')
	else:
		print('NO')


T = int(input())

def solve():
	N = int(input())
	flag = True
	(p, c) = list(map(int, input().split()))
	if c > p:
		flag = False
	(prev_p, prev_c) = (p, c)
	for _ in range(N - 1):
		(p, c) = list(map(int, input().split()))
		if p < prev_p or c < prev_c or c > p or (p - prev_p < c - prev_c):
			flag = False
		(prev_p, prev_c) = (p, c)
	return flag
for i in range(T):
	if solve():
		print('Yes')
	else:
		print('No')


for T in range(int(input())):
	n = int(input())
	plast = 0
	clast = 0
	flag = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < c:
			flag = False
		if p < plast:
			flag = False
		if c < clast:
			flag = False
		if p - plast < c - clast:
			flag = False
		plast = p
		clast = c
	if flag == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	pl = []
	cl = []
	x = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		pl.append(p)
		cl.append(c)
	if pl[0] < cl[0]:
		x += 1
	for i in range(n - 1):
		if pl[i + 1] < pl[i] or cl[i + 1] < cl[i] or pl[i + 1] < cl[i + 1]:
			x += 1
		if cl[i + 1] - cl[i] > pl[i + 1] - pl[i]:
			x += 1
	if x == 0:
		print('YES')
	else:
		print('NO')


for _ in range(0, int(input())):
	n = int(input())
	ans = 1
	(p, c) = map(int, input().split())
	if c > p:
		ans = 0
	for i in range(1, n):
		(x, y) = map(int, input().split())
		if x < p or y < c or y > x or (x - p < y - c):
			ans = 0
		(p, c) = (x, y)
	r = ['NO', 'YES']
	print(r[ans])


for j in range(int(input())):
	n = int(input())
	pp = 0
	cp = 0
	flag = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if not (p - pp >= c - cp and p >= pp and (c >= cp)):
			flag = 1
		else:
			pp = p
			cp = c
	if flag:
		print('NO')
	else:
		print('YES')


for t_ in range(int(input())):
	n = int(input())
	pc = []
	for i in range(n):
		pc.append([*map(int, input().split())])
	valid = pc[0][0] >= pc[0][1]
	if valid:
		for i in range(1, n):
			d0 = pc[i][0] - pc[i - 1][0]
			d1 = pc[i][1] - pc[i - 1][1]
			if not (d1 >= 0 and d0 >= 0 and (d0 >= d1)):
				valid = False
				break
	print(['NO', 'YES'][valid])


for _ in range(int(input())):
	n = int(input())
	p = []
	c = []
	is_true = True
	for i in range(n):
		(x, y) = map(int, input().split())
		p.append(x)
		c.append(y)
		if i == 0 and c[i] > p[i]:
			is_true = False
		elif p[i] - p[i - 1] < c[i] - c[i - 1] or p[i] < c[i]:
			is_true = False
		elif p[i] < p[i - 1] or c[i] < c[i - 1]:
			is_true = False
	if is_true:
		print('YES')
	else:
		print('NO')


import sys
import heapq

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, input().split())

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

def YES(flag):
	if flag:
		return 'YES'
	return 'NO'

def main():
	n = iinput()
	(res, a, z) = (True, 0, 0)
	for i in range(n):
		(p, c) = rinput()
		if p < a or c < z or p + z < c + a:
			res = False
		(a, z) = (p, c)
	print(YES(res))
for i in range(iinput()):
	main()


t = int(input())
for i in range(0, t):
	n = int(input())
	prevclears = 0
	prevplays = 0
	possible = True
	for j in range(0, n):
		(plays, clears) = input().split()
		plays = int(plays)
		clears = int(clears)
		if clears - prevclears > plays - prevplays or clears - prevclears < 0 or plays - prevplays < 0:
			possible = False
		prevclears = clears
		prevplays = plays
	if possible:
		print('YES')
	else:
		print('NO')


def output(nums):
	(prev_p, prev_c) = (nums[0][0], nums[0][1])
	if prev_c > prev_p:
		return False
	for (p, c) in nums:
		if p < prev_p or c < prev_c:
			return False
		if c > prev_c and p == prev_p:
			return False
		elif c > prev_c and p > prev_p:
			if c - prev_c > p - prev_p:
				return False
		(prev_p, prev_c) = (p, c)
	return True
t = int(input())
while t != 0:
	n = int(input())
	data = []
	for i in range(n):
		(p, c) = map(int, input().split())
		data.append([p, c])
	if output(data):
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	(p, c) = map(int, input().split())
	flag = 0
	if c > p:
		flag = 1
	for __ in range(1, n):
		(pi, ci) = map(int, input().split())
		if p == pi and c == ci:
			continue
		if pi <= p or ci < c or ci > pi or (pi - p < ci - c):
			flag = 1
		(p, c) = (pi, ci)
	if flag == 1:
		print('No')
	else:
		print('Yes')


t = int(input())
for q in range(t):
	pr1 = -1
	pr2 = -1
	e = 1
	n = int(input())
	for i in range(n):
		(l, r) = map(int, input().split())
		if i == 0:
			pr1 = l
			pr2 = r
			if r > l:
				e = 0
		elif r > l or l - r < pr1 - pr2 or l < pr1 or (r < pr2):
			e = 0
		pr1 = l
		pr2 = r
	if not e:
		print('NO')
	else:
		print('YES')


def process():
	n = int(input())
	dt = [tuple(map(int, input().split())) for p in range(n)]
	for i in range(n):
		if dt[i][1] > dt[i][0]:
			return False
		if i < n - 1:
			if dt[i + 1][1] - dt[i][1] > dt[i + 1][0] - dt[i][0]:
				return False
			if min(dt[i + 1][1] - dt[i][1], dt[i + 1][0] - dt[i][0]) < 0:
				return False
	return True
print(*['YES' if process() else 'NO' for i in range(int(input()))], sep='\n')


t = int(input())
for j in range(t):
	n = int(input())
	P = [0] * n
	C = [0] * n
	k = 0
	for i in range(n):
		(P[i], C[i]) = map(int, input().split(' '))
	if n == 1:
		if P[0] < C[0]:
			k += 1
	else:
		for i in range(1, n):
			if P[i - 1] < C[i - 1] or P[i] < C[i] or P[i] < P[i - 1] or (C[i] < C[i - 1]) or (C[i] - C[i - 1] > P[i] - P[i - 1]):
				k += 1
	print('yes' if k == 0 else 'no')
	del P[:]
	del C[:]


for _ in range(int(input())):
	n = int(input())
	arr = []
	for i in range(n):
		(a, b) = map(int, input().split())
		arr.append((a, b))
	flag = 0
	for loop in range(n):
		if loop == 0:
			if arr[loop][1] > arr[loop][0]:
				flag = 1
				break
		else:
			if arr[loop][1] > arr[loop][0]:
				flag = 1
				break
			if arr[loop][0] < arr[loop - 1][0]:
				flag = 1
				break
			if arr[loop][1] < arr[loop - 1][1]:
				flag = 1
				break
			if arr[loop][1] - arr[loop - 1][1] > arr[loop][0] - arr[loop - 1][0]:
				flag = 1
				break
	if flag == 1:
		print('NO')
	else:
		print('YES')


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def case():
	n = I()
	(p, q) = (0, 0)
	f = 1
	for i in range(n):
		(x, y) = li()
		if x - p < y - q or y < q:
			f = 0
		(p, q) = (x, y)
	if f:
		print('YES')
	else:
		print('NO')
for _ in range(int(input())):
	case()


tries = int(input())
results = []
for trial in range(tries):
	times = int(input())
	result = 'YES'
	last_max_x = 0
	last_max_p = 0
	for i in range(times):
		(p, x) = map(int, input().split())
		diff_p = p - last_max_p
		diff_x = x - last_max_x
		if result == 'YES':
			if x > p or p < last_max_p or x < last_max_x or (diff_x > diff_p):
				result = 'NO'
		last_max_p = p
		last_max_x = x
	results.append(result)
for result in results:
	print(result)


t = int(input())
for tt in range(t):
	n = int(input())
	p_last = 0
	c_last = 0
	valid = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < p_last or c < c_last:
			valid = False
		dc = c - c_last
		dp = p - p_last
		if dc > dp:
			valid = False
		p_last = p
		c_last = c
	if valid:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	ans = 'YES'
	for j in range(n):
		(x, y) = map(int, input().split())
		a.append([x, y])
		if j > 0:
			if a[j][0] < a[j - 1][0]:
				ans = 'NO'
			if a[j][1] < a[j - 1][1]:
				ans = 'NO'
			if a[j][0] < a[j][1]:
				ans = 'NO'
			if a[j][0] - a[j - 1][0] < a[j][1] - a[j - 1][1]:
				ans = 'NO'
		elif a[j][0] < a[j][1]:
			ans = 'NO'
	print(ans)


T = int(input())
for _ in range(T):
	n = int(input())
	(pp, pc) = (0, 0)
	flag = True
	for _ in range(n):
		(p, c) = map(int, input().split())
		if p < pp:
			flag = False
		elif p == pp:
			if c != pc:
				flag = False
		elif c < pc or c - pc > p - pp:
			flag = False
		(pp, pc) = (p, c)
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(p, c) = (0, 0)
	f = True
	for _ in range(int(input())):
		(old_p, old_c) = (p, c)
		(p, c) = map(int, input().split())
		if old_c < c and p - (c - old_c) < old_p or old_c > c or old_p > p:
			f = False
	print(['NO', 'YES'][f])


T = int(input())
ans = ['YES'] * T
for t in range(T):
	n = int(input())
	ar = []
	for i in range(n):
		ar.append([int(j) for j in input().split(' ')])
	(i, go) = (1, True)
	if ar[0][0] < ar[0][1]:
		(ans[t], go) = ('NO', False)
	while go and i < n:
		if ar[i][0] >= ar[i - 1][0]:
			if ar[i][0] - ar[i - 1][0] < ar[i][1] - ar[i - 1][1]:
				(ans[t], go) = ('NO', False)
			elif ar[i][1] - ar[i - 1][1] < 0:
				(ans[t], go) = ('NO', False)
		elif ar[i][0] < ar[i - 1][0]:
			(ans[t], go) = ('NO', False)
		elif ar[i][0] < ar[i][1]:
			(ans[t], go) = ('NO', False)
		i += 1
for a in ans:
	print(a)


t = int(input())
for _ in range(t):
	ans = 'YES'
	n = int(input())
	(prevP, prevC) = map(int, input().split())
	if prevC > prevP:
		ans = 'NO'
	for _ in range(n - 1):
		(p, c) = map(int, input().split())
		if prevP > p or prevC > c or c > p or (c - prevC > p - prevP):
			ans = 'NO'
		prevP = p
		prevC = c
	print(ans)


for _ in range(int(input())):
	l1 = l2 = 0
	ans = 'YES'
	for i in range(int(input())):
		(q, w) = map(int, input().split())
		if q < l1 or w < l2:
			ans = 'NO'
		if q - l1 < w - l2:
			ans = 'NO'
		(l1, l2) = (q, w)
	print(ans)


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
t = int(input())
for _ in range(t):
	n = int(input())
	prev_a = 0
	prev_b = 0
	flag = True
	l = []
	for i in range(n):
		(a, b) = map(int, input().split())
		l.append([a, b])
	for (a, b) in l:
		if a < prev_b or b < prev_b:
			flag = False
			break
		if a - prev_a < b - prev_b:
			flag = False
			break
		prev_a = a
		prev_b = b
	if flag:
		print('YES')
	else:
		print('NO')


from math import ceil, gcd, floor
from collections import deque, defaultdict
from heapq import heappush as hpush, heappop as hpop, heapify
from functools import lru_cache
testcase = int(input())
for _ in range(testcase):
	n = int(input())
	prev = [0, 0]
	f = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		if a >= prev[0] and b >= prev[1] and (a >= b) and (a - prev[0] >= b - prev[1]):
			prev = [a, b]
		else:
			f = 1
	if f:
		print('NO')
	else:
		print('YES')


import sys
import io, os

def main():
	t = int(input())
	for i in range(t):
		(p, c) = ([], [])
		n = int(input())
		for i in range(n):
			(p1, c1) = map(int, input().split())
			p.append(p1)
			c.append(c1)
		if p[0] >= c[0]:
			ok = True
		else:
			ok = False
		for i in range(1, len(p)):
			if p[i] >= p[i - 1] and c[i] >= c[i - 1]:
				if p[i] - p[i - 1] >= c[i] - c[i - 1] and p[i] >= c[i]:
					continue
				else:
					ok = False
					break
			else:
				ok = False
				break
		if ok == False:
			print('NO')
		else:
			print('YES')
main()


t = int(input())
for rep in range(t):
	n = int(input())
	pp = 0
	cc = 0
	ff = 0
	for ii in range(n):
		(p, c) = list(map(int, input().split()))
		if p < pp or c < cc or p < c or (p - pp < c - cc):
			ff = 1
		else:
			pp = p
			cc = c
	if ff == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [tuple(map(int, input().split())) for i in range(n)]
	ans = 'YES'
	for i in range(n):
		if a[i][0] < a[i][1]:
			ans = 'NO'
		if i == 0:
			continue
		d0 = a[i][0] - a[i - 1][0]
		d1 = a[i][1] - a[i - 1][1]
		if d0 < 0 or d1 < 0:
			ans = 'NO'
		if d0 < d1:
			ans = 'NO'
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	items = [(0, 0)]
	for i in range(n):
		(p, c) = list(map(int, input().split()))
		item = (p, c)
		items.append(item)
	flag = 0
	for i in range(n):
		a = items[i + 1][0] - items[i][0]
		b = items[i + 1][1] - items[i][1]
		if b > a or a < 0 or b < 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(p, c) = (0, 0)
	n = int(input())
	l = [tuple(map(int, input().split())) for _ in range(n)]
	for (u, v) in l:
		if p <= u and c <= v and (u >= v) and (u - p >= v - c):
			p = u
			c = v
		else:
			print('NO')
			break
	else:
		print('YES')


def berlio(plist, clist):
	for i in range(1, len(plist)):
		if plist[i] - plist[i - 1] < clist[i] - clist[i - 1] or plist[i] < plist[i - 1] or clist[i] < clist[i - 1] or (plist[i] < clist[i]):
			ans = 'NO'
			break
		else:
			ans = 'YES'
	return ans
for _ in range(int(input())):
	plist = [0]
	clist = [0]
	for _ in range(int(input())):
		(p, c) = map(int, input().split())
		plist.append(p)
		clist.append(c)
	print(berlio(plist, clist))


R = lambda : map(int, input().split())
t = int(input())
for _ in range(t):
	n = int(input())
	poss = True
	(p1, c1) = R()
	temp = p1 - c1
	if temp < 0:
		poss = False
	for _ in range(1, n):
		(p, c) = R()
		if p < p1 or c < c1 or temp > p - c:
			poss = False
		(temp, p1, c1) = (p - c, p, c)
	if poss:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	pp = 0
	pc = 0
	z = 0
	for i in range(n):
		(p, c) = list(map(int, input().split()))
		if p >= pp and c >= pc and (p >= c) and (p - pp >= c - pc):
			if p == pp:
				if c == pc:
					continue
				else:
					z = 1
			pp = p
			pc = c
		else:
			z = 1
	if z == 1:
		print('NO')
	else:
		print('YES')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	p = []
	c = []
	for i in range(n):
		(x, y) = map(int, input().split())
		p.append(x)
		c.append(y)
	cnt = 0
	if c[0] > p[0]:
		cnt = 1
	for i in range(1, n):
		if c[i] > p[i]:
			cnt = 1
		if p[i] < p[i - 1]:
			cnt = 1
		if c[i] < c[i - 1]:
			cnt = 1
		if c[i] - c[i - 1] > p[i] - p[i - 1]:
			cnt = 1
	if cnt == 1:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
from collections import *
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	n = inp()
	(p, q) = (0, 0)
	f = 0
	for i in range(n):
		(x, y) = mp()
		if x < p or y < q or y - q > x - p:
			f = 1
		(p, q) = (x, y)
	pr('YES' if f == 0 else 'NO')
for _ in range(inp()):
	solve()


def game(n, A):
	maxi_p = A[0][0]
	maxi_c = A[0][1]
	if maxi_c > maxi_p:
		return 'NO'
	for i in range(1, n):
		if A[i][0] < maxi_p or A[i][1] < maxi_c or A[i][0] < A[i][1] or (A[i][0] - A[i - 1][0] < A[i][1] - A[i - 1][1]):
			return 'NO'
		maxi_p = max(maxi_p, A[i][0])
		maxi_c = max(maxi_c, A[i][1])
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	for i in range(n):
		(a, b) = map(int, input().split())
		arr.append([a, b])
	print(game(n, arr))


results = []
num_test_cases = int(input())
for test_case in range(num_test_cases):
	num_obs = int(input())
	obs_lst = []
	for obs in range(num_obs):
		obs_lst.append(list(map(int, input().split())))
	if len(obs_lst) == 1:
		if obs_lst[0][1] > obs_lst[0][0]:
			results.append('No')
			continue
		else:
			results.append('Yes')
			continue
	ply_lst = []
	clr_lst = []
	for obs in obs_lst:
		ply_lst.append(obs[0])
		clr_lst.append(obs[1])
	if ply_lst[0] < clr_lst[0]:
		results.append('No')
		continue
	ply_diff_lst = []
	clr_diff_lst = []
	for index in range(len(ply_lst) - 1):
		ply_diff_lst.append(ply_lst[index + 1] - ply_lst[index])
		clr_diff_lst.append(clr_lst[index + 1] - clr_lst[index])
	if min(ply_diff_lst) < 0 or min(clr_diff_lst) < 0:
		results.append('No')
		continue
	diffs_passen = True
	for index in range(len(ply_diff_lst)):
		if clr_diff_lst[index] > ply_diff_lst[index]:
			diffs_passen = False
			break
	if not diffs_passen:
		results.append('No')
		continue
	results.append('Yes')
print(*results, sep='\n')


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	n = val()
	l = []
	for i in range(n):
		l.append(li())
	ans = 'YES'
	for i in range(n):
		if l[i][0] < l[i][1]:
			ans = 'NO'
			break
		for j in range(i + 1, n):
			if l[j][0] - l[i][0] < l[j][1] - l[i][1] or l[i][0] > l[j][0] or l[i][1] > l[j][1]:
				ans = 'NO'
				break
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	for i in range(n):
		(p, c) = map(int, input().strip().split())
		l.append([p, c])
	diff1 = 0
	diff2 = 0
	f = 0
	for i in range(1, n):
		diff1 = l[i][0] - l[i - 1][0]
		diff2 = l[i][1] - l[i - 1][1]
		if diff1 < 0 or diff2 < 0:
			f = 1
			break
		if diff1 < diff2:
			f = 1
			break
		if l[i][0] < l[i][1] or l[i - 1][0] < l[i - 1][1]:
			f = 1
			break
	if l[0][0] < l[0][1]:
		print('NO')
	elif f == 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	p = [tuple([int(i) for i in input().split()]) for i in range(n)]
	pre = (0, 0)
	g = 1
	for nex in p:
		ip = nex[0] - pre[0]
		ic = nex[1] - pre[1]
		if ip < 0 or ic < 0 or ic > ip:
			g = 0
			break
		pre = nex
	if g:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	p = []
	c = []
	for j in range(n):
		(pi, ci) = [int(x) for x in input().split()]
		p.append(pi)
		c.append(ci)
	flag = 0
	for j in range(n):
		if p[j] < c[j]:
			flag = 1
			break
	for j in range(1, n):
		if (p[j] < p[j - 1] or c[j] < c[j - 1]) or p[j] - p[j - 1] < c[j] - c[j - 1]:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	ps = 0
	cs = 0
	cnt = 0
	for j in range(n):
		(p, c) = map(int, input().split())
		if (p - ps < 0 or p - ps < c - cs or c - cs < 0) and cnt == 0:
			print('NO')
			cnt += 1
		else:
			ps = p
			cs = c
	if cnt == 0:
		print('YES')


import sys
input = sys.stdin.buffer.readline

def solve():
	n = int(input())
	(p, c) = (0, 0)
	ch = 0
	for i in range(n):
		(x, y) = map(int, input().split())
		if x < p or y < c or y - c > x - p:
			ch = 1
		p = x
		c = y
	if ch == 1:
		print('NO')
	else:
		print('YES')
t = int(input())
while t:
	t -= 1
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	p = []
	c = []
	for i in range(n):
		(pi, ci) = map(int, input().split())
		c.append(ci)
		p.append(pi)
	poss = True
	(c0, p0) = (c[0], p[0])
	if p0 < c0:
		poss = False
	for i in range(1, n):
		if p[i] < p[i - 1]:
			poss = False
		if c[i] < c[i - 1]:
			poss = False
		if p[i] < c[i]:
			poss = False
		if c[i] - c[i - 1] > p[i] - p[i - 1]:
			poss = False
		if not poss:
			break
	if poss:
		print('YES')
	else:
		print('NO')


for j in range(int(input())):
	n = int(input())
	a = list()
	a.append([0, 0])
	for i in range(n):
		(c, b) = map(int, input().split())
		a.append([c, b])
	fund = True
	for i in range(1, n + 1):
		if a[i][0] >= a[i - 1][0] and a[i][1] >= a[i - 1][1] and (a[i][0] - a[i - 1][0] >= a[i][1] - a[i - 1][1]):
			pass
		else:
			fund = False
	if not fund:
		print('NO')
	else:
		print('YES')


T = int(input())
for _ in range(0, T):
	n = int(input())
	L = []
	p = 0
	c = 0
	temp = 'YES'
	for i in range(0, n):
		(a, b) = map(int, input().split())
		if a < p or b < c:
			temp = 'NO'
		else:
			diff1 = a - p
			diff2 = b - c
			if diff2 > diff1:
				temp = 'NO'
		p = max(p, a)
		c = max(c, b)
	print(temp)


t = int(input())
for _ in range(t):
	n = int(input())
	a = 0
	b = 0
	r = 'YES'
	while n:
		(n1, n2) = map(int, input().rstrip().split(' '))
		if n1 < a or n2 < b or n1 < n2 or (n2 - b > n1 - a):
			r = 'NO'
		a = n1
		b = n2
		n -= 1
	print(r)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

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

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

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime
from collections import deque
import collections

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	yo = 0
	for _ in range(ri()):
		yo += 1
		n = ri()
		ans = 'YES'
		(p, c) = ria()
		if c > p:
			ans = 'NO'
		a = p
		b = c
		for i in range(n - 1):
			(p, c) = ria()
			if c > p or a > p or b > c or (c - b > p - a):
				ans = 'NO'
			a = p
			b = c
		ws(ans)

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


def is_possible(n):
	jogadas = 0
	clears = 0
	ver = False
	for i in range(n):
		lista = [int(valor) for valor in input().split()]
		aux_jogadas = lista[0]
		aux_clears = lista[1]
		if aux_jogadas < jogadas:
			ver = True
		if aux_clears < clears:
			ver = True
		variacao_jogadas = aux_jogadas - jogadas
		variacao_clears = aux_clears - clears
		if variacao_clears > variacao_jogadas:
			ver = True
		jogadas = lista[0]
		clears = lista[1]
	if ver:
		return 'NO'
	else:
		return 'YES'
entrada = int(input())
for i in range(entrada):
	n = int(input())
	print(is_possible(n))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	play = []
	clear = []
	z = n
	while z > 0:
		(p, c) = map(int, input().split())
		play.append(p)
		clear.append(c)
		z -= 1
	a = 1
	b = 1
	c = 1
	d = 1
	for i in range(n):
		if clear[i] > play[i]:
			a = 0
			break
	for i in range(n - 1):
		if clear[i + 1] < clear[i] or play[i + 1] < play[i]:
			b = 0
			break
	for i in range(n - 1):
		if clear[i + 1] > clear[i] and play[i + 1] <= play[i]:
			c = 0
			break
	for i in range(n - 1):
		if clear[i + 1] - clear[i] > play[i + 1] - play[i]:
			d = 0
			break
	if a == 1 and b == 1 and (c == 1) and (d == 1):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	possible = True
	mp = mc = -1
	pp = pc = -1
	for _ in range(n):
		(p, c) = map(int, input().split())
		if p < mp or c < mc or c > p or (c - pc > p - pp):
			possible = False
		(pp, pc) = (p, c)
		mp = max(mp, p)
		mc = max(mc, c)
	print('YES' if possible else 'NO')


T = int(input())
for _ in range(T):
	n = int(input())
	(p, c) = (0, 0)
	ans = True
	for _ in range(n):
		(pi, ci) = list(map(int, input().split()))
		ans &= pi >= p
		ans &= ci >= c
		ans &= pi >= ci
		ans &= pi - p >= ci - c
		(p, c) = (pi, ci)
	print('YES' if ans else 'NO')


for pratyush in range(int(input())):
	n = int(input())
	(l, f) = ([], 'YES')
	for i in range(n):
		(x, y) = map(int, input().split())
		l.append((x, y))
		if y > x:
			f = 'NO'
		if i == 0 or f == 'NO':
			continue
		(t, c) = (l[i][0] - l[i - 1][0], l[i][1] - l[i - 1][1])
		if c > t or c < 0 or t < 0:
			f = 'NO'
	print(f)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(int(input())):
	n = int(input())
	m = 0
	ma = 0
	f = 0
	for j in range(n):
		(a, b) = map(int, input().split())
		if a == m:
			if b != ma:
				f = 1
		elif a > m:
			if b < ma:
				f = 1
			elif b - ma > a - m:
				f = 1
		else:
			f = 1
		m = a
		ma = b
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(1, t + 1):
	n = int(input())
	p = 0
	c = 0
	result = 1
	for j in range(n):
		(a, b) = map(int, input().split())
		if a < p or b < c or b - c > a - p:
			result = 0
		p = a
		c = b
	if result:
		print('YES')
	else:
		print('NO')


for test in range(int(input())):
	a = []
	for _ in range(int(input())):
		a.append(tuple(map(int, input().split())))
	if a[0][0] >= a[0][1]:
		ans = 'YES'
	else:
		print('NO')
		continue
	for i in range(1, len(a)):
		if a[i][0] < a[i][1]:
			ans = 'NO'
			break
		if a[i][0] > a[i - 1][0]:
			c_access = a[i][0] - a[i - 1][0]
		elif a[i][0] == a[i - 1][0]:
			c_access = 0
		else:
			ans = 'NO'
			break
		if a[i][1] - a[i - 1][1] > c_access or a[i][1] < a[i - 1][1]:
			ans = 'NO'
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	(ci, pi) = (0, 0)
	x = 0
	for i in range(0, n):
		(p, c) = map(int, input().split())
		if ci > c or pi > p or c > p or (c - ci > p - pi):
			x = 1
		ci = c
		pi = p
	if x == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for m in range(t):
	n = int(input())
	la = 0
	lb = 0
	flag = 0
	l = []
	for _ in range(n):
		(a, b) = input().split()
		a = int(a)
		b = int(b)
		l.append((a, b))
	for _ in range(n):
		(a, b) = (l[_][0], l[_][1])
		if a < la:
			print('NO')
			flag = 1
			break
		if b < lb:
			print('NO')
			flag = 1
			break
		if a < b:
			print('NO')
			flag = 1
			break
		if a - la < b - lb:
			print('NO')
			flag = 1
			break
		la = a
		lb = b
	if flag == 0:
		print('YES')


import sys
inp = sys.stdin.readline
t = int(inp())
while t:
	t -= 1
	n = int(inp())
	bp = 0
	bc = 0
	flag = True
	while n:
		n -= 1
		(p, c) = map(int, inp().split())
		if p < bp or c < bc or bc - c < bp - p:
			flag = False
		(bp, bc) = (p, c)
	if flag == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	a = []
	n = int(input())
	for i in range(n):
		temp = list(map(int, input().split()))
		a.append(temp)
	flag = 0
	for i in range(0, len(a)):
		if a[i][1] > a[i][0]:
			flag = 1
			break
	for i in range(1, len(a)):
		if a[i][1] < a[i - 1][1] or a[i][0] < a[i - 1][0]:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		flag1 = 0
		for i in range(1, len(a)):
			if a[i][0] - a[i - 1][0] < a[i][1] - a[i - 1][1]:
				flag1 = 1
				break
		if flag1 == 1:
			print('NO')
		else:
			print('YES')


num = int(input())
for i in range(num):
	n = int(input())
	s1 = [0]
	s2 = [0]
	for j in range(n):
		(s, t) = map(int, input().split())
		s1 += [s]
		s2 += [t]
	for j in range(n):
		s = s1[j + 1] - s1[j]
		t = s2[j + 1] - s2[j]
		if s < t or s < 0 or t < 0:
			print('NO')
			break
	else:
		print('YES')


def func():
	n = int(input())
	s = 0
	e = 0
	pcl = []
	for _ in range(n):
		(p, c) = map(int, input().split())
		pcl.append((p, c))
	for (p, c) in pcl:
		if p < c:
			print('NO')
			return
		if p - s < c - e:
			print('NO')
			return
		if s > p:
			print('NO')
			return
		if e > c:
			print('NO')
			return
		s = p
		e = c
	print('YES')
	return
t = int(input())
for _ in range(t):
	func()


t = int(input())
for z in range(t):
	l1 = []
	l2 = []
	n = int(input())
	b = True
	for i in range(n):
		(p, c) = map(int, input().split())
		l1.append(p)
		l2.append(c)
		if p < c:
			b = False
	for i in range(1, n):
		if l1[i] < l1[i - 1]:
			b = False
		if l2[i] < l2[i - 1]:
			b = False
		if l1[i] - l1[i - 1] < l2[i] - l2[i - 1]:
			b = False
	if b:
		print('YES')
	else:
		print('NO')


def solve(l, n):
	(p1, c1) = (l[0][0], l[0][1])
	f = 0
	if p1 < c1:
		f = 1
	if f == 0:
		for j in range(1, n):
			if p1 <= l[j][0] and c1 <= l[j][1]:
				if l[j][0] - p1 >= l[j][1] - c1 and l[j][1] <= l[j][0]:
					(p1, c1) = (l[j][0], l[j][1])
					continue
				else:
					f = 1
					break
			else:
				f = 1
				break
	if f == 0:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(t):
	n = int(input())
	l = []
	for j in range(n):
		(p, c) = map(int, input().split())
		l.append([p, c])
	solve(l, n)


import os
import sys
from io import BytesIO, IOBase
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	try:
		for _ in range(inp()):
			n = inp()
			(plays, clears) = (0, 0)
			flag = True
			for i in range(n):
				(p, c) = invr()
				if plays > p or clears > c or c - clears > p - plays or (c > p):
					flag = False
				plays = p
				clears = c
			if flag:
				print('YES')
			else:
				print('NO')
	except Exception as e:
		raise e
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


I = input
for q in range(int(I())):
	result = 'YES'
	pl = []
	for w in range(int(I())):
		e = tuple(map(int, I().split()))
		pl.append(e)
	p = 0
	l = 0
	for i in pl:
		if i[1] - l > i[0] - p:
			result = 'NO'
		if i[0] < p:
			result = 'NO'
		if i[1] < l:
			result = 'NO'
		if i[0] < i[1]:
			result = 'NO'
		p = i[0]
		l = i[1]
		if result == 'NO':
			break
	print(result)


for _ in range(int(input())):
	n = int(input())
	(p0, c0) = (0, 0)
	(p1, c1) = (0, 0)
	chk = True
	for i in range(n):
		(p0, c0) = (p1, c1)
		(p1, c1) = map(int, input().split(' '))
		if chk:
			if p0 > p1 or c0 > c1 or c1 - c0 > p1 - p0:
				chk = False
	if chk:
		print('YES')
	else:
		print('NO')


def solution():
	n = int(input())
	data = []
	for i in range(n):
		data.append([int(x) for x in input().split()])
	(prevP, prevC) = data[0]
	if prevC > prevP:
		print('NO')
		return
	for i in range(n - 1):
		(curP, cutC) = data[i + 1]
		if curP < prevP or cutC < prevC or cutC > curP or (curP - prevP < cutC - prevC):
			print('NO')
			return
		prevC = cutC
		prevP = curP
	print('YES')
T = int(input())
for _ in range(1, T + 1):
	solution()


for _ in range(int(input())):
	(a, b) = ([], [])
	yes = True
	for i in range(int(input())):
		(p, c) = map(int, input().split())
		if a == [] and b == []:
			a.append(p)
			b.append(c)
		if c > p:
			yes = False
		elif p - a[-1] >= c - b[-1]:
			a.append(p)
			b.append(c)
		else:
			yes = False
	if yes:
		d = sorted(a)
		e = sorted(b)
		if d == a and e == b:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


T = int(input())
for i in range(T):
	n = int(input())
	Oboje_list = []
	for j in range(n):
		Oboje_list.append(list(map(int, input().split())))
	P_list = []
	C_list = []
	for x in range(len(Oboje_list)):
		P_list.append(Oboje_list[x][0])
		C_list.append(Oboje_list[x][1])
	Value = 1
	P2 = sorted(P_list)
	C2 = sorted(C_list)
	if P2 != P_list:
		Value = 0
	if C2 != C_list:
		Value = 0
	for B in range(len(P2)):
		if C2[B] > P2[B]:
			Value = 0
	for B in range(1, len(P2)):
		DELTA_P = P2[B] - P2[B - 1]
		DELTA_C = C2[B] - C2[B - 1]
		if DELTA_C > DELTA_P:
			Value = 0
	if Value == 0:
		print('NO')
	else:
		print('YES')
	Oboje_list.clear()
	P_list.clear()
	C_list.clear()


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	a = []
	k = int(sys.stdin.readline())
	flag = True
	for i in range(k):
		(x, y) = map(int, input().split())
		a.append([x, y])
	if a[0][0] < a[0][1]:
		flag = False
	for i in range(0, k - 1):
		if a[i + 1][0] - a[i][0] < 0:
			flag = False
		if a[i + 1][1] - a[i][1] < 0:
			flag = False
		if a[i + 1][0] - a[i][0] - (a[i + 1][1] - a[i][1]) < 0:
			flag = False
	if flag == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	(x, y) = (0, 0)
	good = True
	for _a in range(n):
		(a, b) = map(int, input().split())
		if a < x or b < y or a - x < b - y:
			good = False
		(x, y) = (a, b)
	print('YES' if good else 'NO')


t = int(input())
for case in range(t):
	n = int(input())
	(a, b) = (0, 0)
	ok = 1
	for i in range(n):
		(p, c) = map(int, input().split())
		if p - a < 0 or c - b < 0 or p - a < c - b:
			ok = 0
		(a, b) = (p, c)
	if ok:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(bb, cc) = (0, 0)
	ans = True
	a = int(input())
	for i in range(a):
		(b, c) = [int(x) for x in input().split()]
		if b < bb or c < cc or c - cc > b - bb:
			ans = False
		(bb, cc) = (b, c)
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	p = 0
	c = 0
	f = True
	for i in range(n):
		(pi, ci) = map(int, input().split())
		if (ci - c > pi - p or ci - c < 0 or pi - p < 0) and f:
			print('NO')
			f = False
		p = pi
		c = ci
	if f:
		print('YES')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	pairs = []
	for __ in range(int(input())):
		(x, y) = map(int, input().split())
		pairs += [[x, y]]
	pos = True
	for i in range(len(pairs)):
		if pairs[i][1] > pairs[i][0]:
			pos = False
			break
	for i in range(1, len(pairs)):
		if pairs[i][0] < pairs[i - 1][0] or pairs[i][1] < pairs[i - 1][1]:
			pos = False
			break
	for i in range(1, len(pairs)):
		if pairs[i][1] > pairs[i - 1][1]:
			if pairs[i][0] - pairs[i - 1][0] >= pairs[i][1] - pairs[i - 1][1]:
				continue
			else:
				pos = False
				break
	print('YES' if pos else 'NO')


for _ in range(int(input())):
	n = int(input())
	pr = -1
	bool = True
	cr = -1
	for _ in range(n):
		(p, c) = list((int(i) for i in input().split()))
		if pr != -1 and cr != -1:
			if p >= pr and c >= cr and (c <= p):
				if p - pr < c - cr:
					bool = False
				pr = p
				cr = c
			else:
				bool = False
		else:
			pr = p
			cr = c
			if c > p:
				bool = False
	if bool:
		print('YES')
	else:
		print('NO')


def main():
	test = int(input())
	for t in range(test):
		n = int(input())
		prev = 0
		crev = 0
		ans = ''
		for k in range(0, n):
			l = [int(i) for i in input().split(' ')]
			p = l[0]
			c = l[1]
			if len(ans) == 0:
				if p < c:
					ans = 'NO'
				elif p >= prev and c >= crev and (p - prev >= c - crev):
					prev = p
					crev = c
				else:
					ans = 'NO'
		if len(ans) == 0:
			print('YES')
		else:
			print('NO')
main()


import sys
from itertools import accumulate

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	curp = curc = 0
	ok = True
	for _ in range(N):
		(p, c) = MAP()
		if p < curp or c < curc or p < c or (p - curp < c - curc):
			ok = False
		curp = p
		curc = c
	if ok:
		YES()
	else:
		NO()


import sys
for t in range(int(input())):
	n = int(input())
	p = 0
	c = 0
	ans = 'YES'
	for go in range(n):
		temp = list(map(int, input().split(' ')))
		if temp[0] >= p and temp[1] >= c and (temp[0] >= temp[1]) and (temp[0] - p >= temp[1] - c):
			p = temp[0]
			c = temp[1]
		else:
			ans = 'NO'
	print(ans)


t = int(input())
for q in range(t):
	n = int(input())
	plays = []
	clears = []
	for x in range(n):
		(p, c) = map(int, input().split())
		plays.append(p)
		clears.append(c)
	lastp = plays[0]
	lastc = clears[0]
	if lastp < lastc:
		print('NO')
		continue
	flag = True
	for x in range(1, n):
		if clears[x] > lastc and plays[x] <= lastp:
			flag = False
			break
		elif plays[x] < clears[x]:
			flag = False
			break
		elif plays[x] < lastp:
			flag = False
			break
		elif clears[x] < lastc:
			flag = False
			break
		elif clears[x] - lastc > plays[x] - lastp:
			flag = False
			break
		else:
			lastp = plays[x]
			lastc = clears[x]
	if flag:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
T = int(input())
for ti in range(1, T + 1):
	n = int(input())
	p = c = 0
	ok = True
	for i in range(n):
		(cur_p, cur_c) = map(int, input().split())
		if cur_p < p or cur_c < c or cur_c - c > cur_p - p:
			ok = False
		(p, c) = (cur_p, cur_c)
	if ok:
		print('YES')
	else:
		print('NO')


def game(inp):
	for item in inp:
		result = True
		for i in range(len(item)):
			if item[i][0] < item[i][1]:
				result = False
			elif i > 0:
				if item[i - 1][0] > item[i][0] or item[i - 1][1] > item[i][1]:
					result = False
				if item[i][0] - item[i - 1][0] < item[i][1] - item[i - 1][1]:
					result = False
		if result:
			print('YES')
		else:
			print('NO')
t = int(input())
inp = []
for i in range(t):
	n = int(input())
	aux = []
	for j in range(n):
		n = list(map(int, input().split()))
		aux.append(n)
	inp.append(aux)
game(inp)


t = int(input())
for q in range(t):
	n = int(input())
	right = True
	i = 0
	last_p = 0
	last_c = 0
	while i < n:
		(p, c) = map(int, input().split())
		if p < last_p or c < last_c or p - last_p < c - last_c:
			right = False
		last_p = p
		last_c = c
		i += 1
	if right:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	p = 0
	c = 0
	s = 0
	for x in range(n):
		(pn, cn) = map(int, input().split())
		if cn > pn and s == 0:
			print('NO')
			s += 1
			continue
		if (cn < c or pn < p) and s == 0:
			print('NO')
			s += 1
			continue
		if pn == p and cn > c and (s == 0):
			print('NO')
			s += 1
			continue
		if pn - p < cn - c and s == 0:
			print('NO')
			s += 1
			continue
		else:
			p = pn
			c = cn
	if s == 0:
		print('YES')


import sys

def isPossible(n):
	(pprev, cprev) = (0, 0)
	ans = 'Yes'
	for i in range(n):
		(pi, ci) = map(int, sys.stdin.readline().split())
		if pi < pprev or ci < cprev or pi - pprev < ci - cprev:
			ans = 'No'
		(pprev, cprev) = (pi, ci)
	return ans
t = int(input())
for i in range(t):
	n = int(input())
	print(isPossible(n))


for _ in range(int(input())):
	n = int(input())
	(p, c) = (-1, 0)
	flag = True
	for i in range(n):
		(pi, ci) = map(int, input().split())
		if pi < p or ci < c or ci > pi or (ci - c > pi - p):
			flag = False
		(p, c) = (pi, ci)
	print(['yes', 'no'][not flag])


t = int(input())
while t:
	t = t - 1
	n = int(input())
	pp = []
	kk = []
	cc = n
	c = 0
	while n:
		n = n - 1
		(p, k) = map(int, input().split(' '))
		pp.append(p)
		kk.append(k)
	if sorted(pp) != pp or sorted(kk) != kk:
		print('NO')
	else:
		for i in range(len(pp)):
			if pp[i] >= kk[i]:
				c = c + 1
		for i in range(len(pp) - 1):
			if pp[i + 1] - pp[i] < kk[i + 1] - kk[i]:
				c = c - 1
		if c == cc:
			print('YES')
		else:
			print('NO')


q = int(input())
for _ in range(q):
	n = int(input())
	(last_p, last_c) = (0, 0)
	r = 'YES'
	for _ in range(n):
		(p, c) = [int(x) for x in input().split()]
		if c > p:
			r = 'NO'
		elif p < last_p or c < last_c:
			r = 'NO'
		elif c - last_c > p - last_p:
			r = 'NO'
		(last_p, last_c) = (p, c)
	print(r)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
for _ in range(t):
	n = int(input())
	cur1 = 0
	cur2 = 0
	d = 0
	tg = 1
	for ni in range(n):
		(a, b) = map(int, input().split(' '))
		if a >= cur1:
			cur1 = a
		else:
			tg = 0
		if b >= cur2:
			cur2 = b
		else:
			tg = 0
		tmp = a - b
		if tmp >= d:
			d = tmp
		else:
			tg = 0
	if tg:
		print('YES')
	else:
		print('NO')


n = int(input())
for x in range(n):
	t = int(input())
	p = []
	for y in range(t):
		p.append(list(map(int, input().split())))
	for z in range(t):
		if p[z][1] > p[z][0]:
			print('NO')
			break
		if z > 0 and (p[z][1] - p[z - 1][1] > p[z][0] - p[z - 1][0] or (p[z][1] < p[z - 1][1] or p[z][0] < p[z - 1][0])):
			print('NO')
			break
		if z == t - 1:
			print('YES')
			break


def solve(stats):
	for i in range(len(stats)):
		stat = stats[i]
		if stat[1] > stat[0]:
			return 'NO'
		if i > 0:
			prev_stat = stats[i - 1]
			diff_plays = stat[0] - prev_stat[0]
			diff_clears = stat[1] - prev_stat[1]
			if diff_plays < 0 or diff_clears < 0 or diff_plays < diff_clears:
				return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	stats = []
	for j in range(n):
		stats.append(list(map(int, input().split(' '))))
	if len(stats) != n:
		y = 'NO'
	else:
		y = solve(stats)
	print(y)


t = int(input())
for _ in range(t):
	n = int(input())
	(p, j) = (0, 0)
	flag = 0
	for _ in range(n):
		(pi, ji) = map(int, input().split())
		if pi >= p and ji >= j and (ji <= pi) and (pi - p >= ji - j):
			(p, j) = (pi, ji)
		else:
			flag = 1
	if j > p:
		flag = 1
	if flag:
		print('NO')
	else:
		print('YES')


a = int(input())
for _ in range(a):
	x = 0
	y = 0
	v = 0
	k = 0
	z = int(input())
	for i in range(z):
		(a, b) = map(int, input().split())
		if a >= b and a >= x and (b >= y) and (a - b >= k):
			x = a
			y = b
			k = a - b
		else:
			v = 1
	if v == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for j in range(t):
	n = int(input())
	p = []
	c = []
	for i in range(n):
		(x, y) = input().split()
		p.append(int(x))
		c.append(int(y))
	g = 0
	for i in range(0, n):
		for k in range(i, n):
			if p[k] == p[i] and c[k] != c[i]:
				g = 1
			elif p[k] - p[i] < c[k] - c[i]:
				g = 1
			elif p[k] < p[i]:
				g = 1
			elif c[k] < c[i]:
				g = 1
			elif p[i] < c[i]:
				g = 1
	if g == 1:
		print('NO')
	else:
		print('YES')


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log, pi, sin
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	n = int(data())
	(a, b) = sp()
	if b > a:
		result = False
	else:
		result = True
	for i in range(n - 1):
		(c, p) = sp()
		if p > c:
			result = False
		if c < a or p < b:
			result = False
		if c - a < p - b:
			result = False
		(a, b) = (c, p)
	if result:
		out('YES')
		continue
	out('NO')


for _ in range(int(input())):
	n = int(input())
	l = [list(map(int, input().split())) for i in range(n)]
	f = 0
	if l[0][0] < l[0][1]:
		print('NO')
	else:
		for i in range(1, n):
			if l[i][0] >= l[i][1] and l[i][0] == l[i - 1][0] and (l[i][1] == l[i - 1][1]):
				continue
			elif l[i][0] >= l[i][1] and l[i][0] > l[i - 1][0] and (l[i][1] >= l[i - 1][1]) and (l[i][0] - l[i - 1][0] >= l[i][1] - l[i - 1][1]):
				continue
			else:
				f = 1
				break
		if f:
			print('NO')
		else:
			print('YES')


T = int(input())
while T:
	n = int(input())
	P = []
	C = []
	for i in range(n):
		(p, c) = map(int, input().split())
		P.append(p)
		C.append(c)
	flag = 'YES'
	a = P[0]
	b = C[0]
	for i in range(n):
		aa = P[i]
		bb = C[i]
		if aa < a or bb < b or aa < bb or (aa - a < bb - b):
			flag = 'NO'
			break
		a = aa
		b = bb
	print(flag)
	T = T - 1


from sys import stdin, stdout
input = stdin.readline
print = stdout.write

def solve():
	n = int(input())
	ans = 'YES\n'
	(x1, y1) = (0, 0)
	for i in range(n):
		(x, y) = map(int, input().split())
		if ans != 'NO':
			if y - y1 < 0 or x - x1 < 0 or x - x1 < y - y1:
				ans = 'NO\n'
			(x1, y1) = (x, y)
	print(ans)

def main():
	for t in range(int(input())):
		solve()
main()


n = int(input())
for i in range(n):
	a = int(input())
	P = []
	C = []
	for j in range(a):
		(p, c) = map(int, input().split())
		P.append(p)
		C.append(c)
	z = 0
	for k in range(a):
		if z == 0:
			if C[k] > P[k]:
				print('NO')
				z = 1
	for k in range(1, a):
		if z == 0:
			if P[k] < P[k - 1]:
				print('NO')
				z = 1
		if z == 0:
			if C[k] < C[k - 1]:
				print('NO')
				z = 1
		if z == 0:
			if P[k - 1] == P[k] and C[k - 1] != C[k]:
				print('NO')
				z = 1
		if z == 0:
			if P[k] - P[k - 1] < C[k] - C[k - 1]:
				print('NO')
				z = 1
	if z == 0:
		print('YES')


for _ in range(int(input())):
	nb_status = int(input())
	ps = 0
	cs = 0
	ans = 'Yes'
	for i in range(nb_status):
		(p, c) = [int(x) for x in input().split()]
		(pd, cd) = (p - ps, c - cs)
		if pd < 0 or cd < 0 or pd < cd:
			ans = 'NO'
		ps = p
		cs = c
	print(ans)


from collections import *
from itertools import *
from bisect import *

def inp():
	return int(input())

def arrinp():
	return [int(x) for x in input().split()]

def main():
	t = inp()
	for _ in range(t):
		n = inp()
		A = []
		for i in range(n):
			A.append(arrinp())
		possible = True
		(p, c) = A[0]
		if p < c:
			print('NO')
			continue
		for i in range(1, n):
			(p, c) = A[i]
			(p_prev, c_prev) = A[i - 1]
			if p < c:
				possible = False
				break
			if c < c_prev:
				possible = False
				break
			if p < p_prev:
				possible = False
				break
			if p == p_prev and c != c_prev:
				possible = False
				break
			if p > p_prev and c - c_prev > p - p_prev:
				possible = False
				break
		if not possible:
			print('NO')
		else:
			print('YES')
main()


testNumb = input()
answers = []
for _ in range(int(testNumb)):
	inputsNumb = input()
	isCorrect = True
	previousInput = [0, 0]
	for i in range(int(inputsNumb)):
		newInput = input().split()
		newP = int(newInput[0])
		newC = int(newInput[1])
		if newC > newP:
			isCorrect = False
		if i == 0:
			previousInput[0] = newP
			previousInput[1] = newC
		else:
			if newP < previousInput[0] or newC < previousInput[1] or newC - previousInput[1] > newP - previousInput[0]:
				isCorrect = False
			previousInput[0] = newP
			previousInput[1] = newC
	answers.append(isCorrect)
for i in range(len(answers)):
	if answers[i] == True:
		print('YES')
	else:
		print('NO')


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def solve(n):
	return n * (n + 1) // 2
for i in range(10 ** 5):
	pass
t = int(input())
for _ in range(t):
	n = int(input())
	p = []
	c = []
	for i in range(n):
		(x, y) = map(int, input().split())
		p.append(x)
		c.append(y)
	cnt = 0
	if c[0] > p[0]:
		cnt = 1
	for i in range(1, n):
		if c[i] > p[i]:
			cnt = 1
		if p[i] < p[i - 1]:
			cnt = 1
		if c[i] < c[i - 1]:
			cnt = 1
		if c[i] - c[i - 1] > p[i] - p[i - 1]:
			cnt = 1
	if cnt == 1:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left

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

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007
for t in range(I()):
	n = I()
	lis = []
	for i in range(n):
		(a, b) = In()
		lis.append((a, b))
		flag = 1
	(x, y) = lis[0]
	for (x1, y1) in lis:
		if x1 < y1:
			flag = 0
			break
		elif x1 - x < 0 or y1 - y < 0:
			flag = 0
			break
		elif x1 - x == 0:
			if y1 - y != 0:
				flag = 0
				break
		elif x1 - x < y1 - y:
			flag = 0
			break
		else:
			x = x1
			y = y1
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [tuple(map(int, input().split())) for _ in range(n)]
	possible = a[0][1] <= a[0][0]
	for i in range(1, n):
		if a[i][0] - a[i - 1][0] < 0:
			possible = False
		if a[i][1] - a[i - 1][1] < 0:
			possible = False
		if a[i][1] - a[i - 1][1] > a[i][0] - a[i - 1][0]:
			possible = False
	if possible:
		print('YES')
	else:
		print('NO')


t = int(input())
for x in range(t):
	n = int(input())
	(lastp, lastc) = (0, 0)
	ans = 'YES'
	done = False
	for _ in range(n):
		(p, c) = map(int, input().split())
		if done:
			continue
		if p >= lastp and c >= lastc and (c - lastc <= p - lastp):
			lastp = p
			lastc = c
			continue
		else:
			ans = 'NO'
			done = True
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	(p, c) = (0, 0)
	valid = True
	for i in range(n):
		(pn, cn) = input().split()
		(pn, cn) = (int(pn), int(cn))
		if cn > pn or cn < c or pn < p or (cn - c > pn - p):
			valid = False
		p = pn
		c = cn
	if valid:
		print('YES')
	else:
		print('NO')


def statsLevel(res_in):
	if len(res_in) == 0:
		return 'NO'
	if res_in[0][0] < res_in[0][1]:
		return 'NO'
	for i in range(1, len(res_in)):
		if res_in[i - 1][0] > res_in[i][0]:
			return 'NO'
		if res_in[i - 1][1] > res_in[i][1]:
			return 'NO'
		if res_in[i][1] - res_in[i - 1][1] > res_in[i][0] - res_in[i - 1][0]:
			return 'NO'
	return 'YES'

def main():
	T = int(input())
	for i in range(T):
		res_ans = []
		n = int(input())
		res_in = []
		inn = []
		for i in range(n):
			flats = input()
			inn = [int(lt) for lt in flats.split(' ')]
			res_in.append(inn)
		res_ans.append(statsLevel(res_in))
		for i in res_ans:
			print(i)
main()


for nt in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l.append(list(map(int, input().split())))
	flag = 'YES'
	if l[0][0] < l[0][1]:
		print('NO')
		continue
	for i in range(1, n):
		if l[i][0] < l[i][1]:
			flag = 'NO'
			break
		if l[i][0] < l[i - 1][0] or l[i][1] < l[i - 1][1]:
			flag = 'NO'
			break
		if l[i][0] - l[i - 1][0] < l[i][1] - l[i - 1][1]:
			flag = 'NO'
			break
	print(flag)


from sys import stdin

def func(arr):
	(a, b) = (arr[0][0], arr[0][1])
	if b > a:
		return 0
	for i in range(1, len(arr)):
		if arr[i][0] - arr[i - 1][0] < arr[i][1] - arr[i - 1][1] or (arr[i][0] - arr[i - 1][0] < 0 or 0 > arr[i][1] - arr[i - 1][1]):
			return 0
	return 1
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	arr = []
	for i in range(n):
		(p, c) = map(int, stdin.readline().split())
		arr.append([p, c])
	if func(arr) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for cas in range(t):
	n = int(input())
	lastp = 0
	lastc = 0
	isok = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if p - lastp < c - lastc or p - lastp < 0 or c - lastc < 0:
			isok = False
		lastp = p
		lastc = c
	print('Yes' if isok else 'No')


t = int(input())
for i in range(t):
	n = int(input())
	b = []
	flag = 0
	for j in range(n):
		a = list(map(int, input().split()))
		b.append(a)
	for j in range(n):
		if b[j][0] < b[j][1]:
			flag = 1
			break
		else:
			continue
	for j in range(n - 1):
		if b[j][0] > b[j + 1][0]:
			flag = 1
			break
		else:
			continue
	for j in range(n - 1):
		if b[j][1] > b[j + 1][1]:
			flag = 1
			break
		else:
			continue
	for j in range(n - 1):
		if b[j + 1][0] - b[j][0] < b[j + 1][1] - b[j][1]:
			flag = 1
			break
		else:
			continue
	if flag == 1:
		print('NO')
	else:
		print('YES')


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	list_check = [-1, -1]
	error = 0
	for _ in range(N):
		(a, b) = map(int, sys.stdin.readline().split())
		if (list_check[0] > a or list_check[1] > b) or b - list_check[1] > a - list_check[0]:
			error = 1
		list_check = [a, b]
	if error:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	(a, b) = (0, 0)
	ans = 'YES'
	for i in range(int(input())):
		(x, y) = map(int, input().split())
		if a > x or b > y or y > x or (x - a < y - b):
			ans = 'NO'
		else:
			(a, b) = (x, y)
	print(ans)


def main():
	for _ in range(int(input())):
		result = True
		pp = 0
		cc = 0
		for i in range(int(input())):
			(p, c) = map(int, input().split())
			if result:
				dif_p = p - pp
				dif_c = c - cc
				if dif_p < 0 or dif_c < 0 or dif_c > dif_p:
					result = False
				else:
					pp = p
					cc = c
		print('YES' if result else 'NO')
main()


import os
import heapq
import sys, threading
import math as mt
import operator
from copy import copy
from collections import defaultdict, deque
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		n = int(input())
		(play, clear) = (-1, -1)
		ok = True
		for _ in range(n):
			(a, b) = inpt()
			if a < play or b > a or b < clear:
				ok = False
			dif1 = a - play
			dif2 = b - clear
			if dif2 > dif1:
				ok = False
			(play, clear) = (a, b)
		if ok:
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


T = int(input())
while T:
	n = int(input())
	p_ = 0
	c_ = 0
	flag = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if p_ > p or c_ > c or c > p or (c - c_ > p - p_):
			flag = False
		p_ = p
		c_ = c
	if flag:
		print('YES')
	else:
		print('NO')
	T -= 1


no_test = int(input(''))
result = []
if no_test > 0:
	for i in range(no_test):
		no_look = int(input(''))
		look = list()
		for j in range(no_look):
			(x, y) = input('').split()
			(p, c) = (int(x), int(y))
			look.append((p, c))
		count = 1
		if not (look[0][0] >= look[0][1] and look[0][1] >= 0):
			result.append('NO')
			continue
		for k in range(len(look) - 1):
			if look[k + 1][1] - look[k][1] <= look[k + 1][0] - look[k][0] and look[k + 1][1] - look[k][1] >= 0:
				count += 1
		if count == len(look):
			result.append('YES')
		else:
			result.append('NO')
for item in result:
	print(item)


def main():
	n = int(input())
	p = []
	c = []
	for __ in range(n):
		(pi, ci) = map(int, input().split())
		p.append(pi)
		c.append(ci)
	if p[0] < c[0]:
		return 'NO'
	for i in range(1, n):
		if p[i] < c[i]:
			return 'NO'
		x = p[i] - p[i - 1]
		y = c[i] - c[i - 1]
		if x < 0 or y < 0:
			return 'NO'
		if x < y:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	print(main())


from sys import stdin

def main():
	nxt = iter(map(int, stdin.read().split())).__next__
	for _ in range(nxt()):
		u = v = w = f = 0
		for _ in range(nxt()):
			(p, c) = (nxt(), nxt())
			pc = p - c
			if u > p or v > c or w > pc:
				f = 1
			(u, v, w) = (p, c, pc)
		print(('YES', 'NO')[f])
main()


import os
import sys
from io import BytesIO, IOBase

def solution(game, n):
	pi = [game[i][0] for i in range(n)]
	ci = [game[i][1] for i in range(n)]
	if pi != sorted(pi):
		write('NO')
		return
	if ci != sorted(ci):
		write('NO')
		return
	for i in range(n):
		if ci[i] > pi[i]:
			write('NO')
			return
	for i in range(n - 1):
		if pi[i + 1] - pi[i] < ci[i + 1] - ci[i]:
			write('NO')
			return
	write('YES')

def main():
	for _ in range(r_int()):
		n = r_int()
		game = []
		for _ in range(n):
			(p, c) = r_array()
			game.append((p, c))
		solution(game, n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


t = int(input())
for x in range(t):
	n = int(input())
	(pp, pc, ans) = (0, 0, 'YES')
	for y in range(n):
		(cp, cc) = map(int, list(input().split(' ')))
		if cc < pc or cc - pc > cp - pp:
			ans = 'NO'
		pp = cp
		pc = cc
	print(ans)


T = int(input())
massiv_i = []
for i in range(T):
	n = int(input())
	massiv_j = []
	for j in range(n):
		s = input()
		inputs = s.split(' ')
		inputs = list(map(lambda x: int(x), inputs))
		massiv_j.append(inputs)
	massiv_i.append(massiv_j)
for data in massiv_i:
	init_data_item = data[0]
	if len(data) > 1:
		continuum_counter = 0
		for data_item in data[1:]:
			if (data_item[0] >= data_item[1]) & (data_item[1] >= 0) & (init_data_item[0] >= init_data_item[1]) & (init_data_item[1] >= 0) & (data_item[0] >= init_data_item[0]) & (data_item[1] >= init_data_item[1]) & (data_item[0] - init_data_item[0] >= data_item[1] - init_data_item[1]):
				continuum_counter += 1
			init_data_item = data_item
		if continuum_counter == len(data) - 1:
			print('YES')
		else:
			print('NO')
	elif (init_data_item[0] >= init_data_item[1]) & (init_data_item[1] >= 0):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	pl = []
	cl = []
	for i in range(n):
		(p, c) = map(int, input().split())
		pl.append(p)
		cl.append(c)
	flag = 0
	for i in range(0, n):
		if i == 0:
			if pl[i] < cl[i]:
				flag = 1
				break
		elif pl[i] < pl[i - 1] or cl[i] < cl[i - 1]:
			flag = 1
			break
		elif pl[i] - pl[i - 1] < cl[i] - cl[i - 1]:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	(lp, lc) = (0, 0)
	ans = 'YES'
	for _ in range(n):
		(p, c) = map(int, input().split())
		x = p - lp
		y = c - lc
		if x < 0 or y < 0:
			ans = 'NO'
		if x < y:
			ans = 'NO'
		(lp, lc) = (p, c)
	print(ans)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		n = int(input())
		res = True
		(pl, ps) = list(map(int, input().split()))
		if pl < ps:
			res = False
		for i in range(1, n):
			(cl, cs) = list(map(int, input().split()))
			if cl < cs:
				res = False
			elif cl < pl or cs < ps:
				res = False
			(incl, inlc) = (cl - pl, cs - ps)
			if incl < inlc:
				res = False
			(pl, ps) = (cl, cs)
		if res:
			yield 'YES'
		else:
			yield 'NO'
t = int(input())
ans = gift()
print(*ans, sep='\n')


for _ in range(int(input())):
	n = int(input())
	arr = []
	for i in range(n):
		a = [int(i) for i in input().split()]
		arr.append(a)
	if arr[0][0] < arr[0][1]:
		print('NO')
	else:
		alive = True
		for i in range(1, n):
			if arr[i][0] - arr[i - 1][0] < arr[i][1] - arr[i - 1][1] or arr[i][0] - arr[i - 1][0] < 0 or arr[i][1] - arr[i - 1][1] < 0:
				alive = False
				break
		if alive:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = []
	ok = True
	(p, c) = map(int, input().split())
	ok = ok and p >= c
	for i in range(1, n):
		(np, nc) = map(int, input().split())
		ok = ok and np >= nc
		d1 = np - p
		d2 = nc - c
		ok = ok and d1 >= 0 and (d2 >= 0) and (d1 >= d2)
		(p, c) = (np, nc)
	if ok:
		print('YES')
	else:
		print('NO')


n2 = -1
m2 = -2
for _ in range(int(input())):
	result = 'YES'
	for i in range(int(input())):
		(n, m) = map(int, input().split())
		if m > n:
			result = 'NO'
		if i > 0 and m - m2 > n - n2 and (m - m2 > 0):
			result = 'NO'
		if i > 0 and (m < m2 or n < n2):
			result = 'NO'
		n2 = n
		m2 = m
	print(result)


import sys
inp = sys.stdin.readline

def input():
	return inp().strip()
flush = sys.stdout.flush

def iin():
	return int(input())

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

def lts(a, sep=''):
	return '{}'.format(sep).join(a)
out = []

def main():
	T = iin()
	for _ in range(T):
		n = iin()
		(p, c) = (0, 0)
		br = 0
		for lv in range(n):
			(i, j) = lin()
			if br:
				continue
			if i - p < 0 or j - c < 0 or i < j or (j - c > i - p):
				br = 1
			(p, c) = (i, j)
		out.append('YES' if br == 0 else 'NO')
main()
print('\n'.join(out))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
testcases = int(input())
for j in range(testcases):
	n = int(input())
	vp = []
	vc = []
	for s in range(n):
		vals = list(map(int, input().split()))
		p = vals[0]
		c = vals[1]
		vp.append(p)
		vc.append(c)
	dp = []
	dc = []
	for b in range(len(vp)):
		if b == 0:
			dp.append(vp[b])
			dc.append(vc[b])
		else:
			dp.append(vp[b] - vp[b - 1])
			dc.append(vc[b] - vc[b - 1])
	checker = True
	for s in range(len(dp)):
		if dp[s] < dc[s] or dp[s] < 0 or dc[s] < 0:
			checker = False
	if checker == True:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
for i in range(t):
	n = int(input())
	plays = [0]
	clears = [0]
	flag = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		plays.append(a)
		clears.append(b)
	for i in range(1, n + 1):
		if (plays[i] < plays[i - 1] or clears[i] < clears[i - 1]) or plays[i] - plays[i - 1] < clears[i] - clears[i - 1]:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


def doit(P, C, n):
	if P[0] < C[0]:
		print('NO')
		return
	for i in range(1, n):
		if P[i] < P[i - 1] or C[i] < C[i - 1] or C[i] - C[i - 1] > P[i] - P[i - 1] or (P[i - 1] < C[i - 1]) or (P[i] < C[i]):
			print('NO')
			return
	else:
		print('YES')
t = int(input())
for _ in range(t):
	n = int(input())
	P = [0] * n
	C = [0] * n
	for i in range(n):
		(P[i], C[i]) = map(int, input().split())
	doit(P, C, n)


import sys
input = sys.stdin.readline
(t,) = map(int, input().split())
for _ in range(t):
	(N,) = map(int, input().split())
	(ba, bb) = (0, 0)
	f = 0
	for _ in range(N):
		(a, b) = map(int, input().split())
		tmp = a - ba
		tmp2 = b - bb
		if tmp < 0:
			f = 1
		if tmp2 > tmp or tmp2 < 0:
			f = 1
		(ba, bb) = (a, b)
	if f:
		print('NO')
	else:
		print('YES')


T = int(input())
answer = ''
for t in range(T):
	n = int(input())
	ok = True
	x = y = 0
	for i in range(n):
		(a, b) = list(map(int, input().split()))
		if not ok:
			continue
		aa = a - x
		bb = b - y
		if aa < bb or aa < 0 or bb < 0:
			ok = False
			answer += 'NO\n'
			continue
		x = a
		y = b
	if ok:
		answer += 'YES\n'
print(answer)


def solve():
	n = int(input())
	l = [[int(j) for j in input().split()] for i in range(n)]
	max_x = l[0][0]
	max_y = l[0][1]
	if l[0][0] < l[0][1]:
		print('NO')
		return
	for i in range(1, len(l)):
		dx = l[i][0] - l[i - 1][0]
		dy = l[i][1] - l[i - 1][1]
		if max_x > l[i][0] or max_y > l[i][1]:
			print('NO')
			return
		else:
			max_x = l[i][0]
			max_y = l[i][1]
		if dx < dy:
			print('NO')
			return
	print('YES')
T = int(input())
for i in range(T):
	solve()


def main():
	n = int(input())
	(pre_play, pre_clear) = (0, 0)
	no = False
	for _ in range(n):
		(cur_play, cur_clear) = map(int, input().split())
		if cur_clear - pre_clear > cur_play - pre_play or cur_clear < pre_clear or cur_play < pre_play:
			no = True
		pre_play = cur_play
		pre_clear = cur_clear
	print('NO' if no else 'YES')
for _ in range(int(input())):
	main()


def check_validity(p: list, c: list, n: int) -> str:
	if c[0] > p[0]:
		return 'NO'
	(sum_p, sum_c) = (p[0], c[0])
	for i in range(1, n):
		if p[i] < sum_p or c[i] < sum_c:
			return 'NO'
		elif c[i] > p[i]:
			return 'NO'
		elif c[i] - sum_c > p[i] - sum_p and c[i] - sum_c != 0:
			return 'NO'
		sum_p = p[i]
		sum_c = c[i]
	return 'YES'

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		(p, c) = ([], [])
		for _ in range(n):
			(pi, ni) = list(map(int, input().split()))
			p.append(pi)
			c.append(ni)
		res = check_validity(p, c, n)
		print(res)
main()


num = int(input())
k1 = 0
while k1 < num:
	times = int(input())
	k2 = 0
	a0 = 0
	b0 = 0
	no = 0
	while k2 < times:
		(n, m) = map(int, input().split())
		if n < m or a0 > n or b0 > m or (n - a0 < m - b0):
			no = 1
		else:
			a0 = n
			b0 = m
		k2 += 1
	if no == 0:
		print('YES')
	else:
		print('NO')
	k1 += 1


for _ in range(int(input())):
	(pp, pc) = (0, 0)
	valid = True
	for _ in range(int(input())):
		(p, c) = map(int, input().split())
		if valid:
			if p >= pp and c >= pc and (p - pp >= c - pc):
				pp = p
				pc = c
			else:
				valid = False
	print('YES' if valid else 'NO')


T = int(input())
res = []
for i in range(T):
	n = int(input())
	p0 = 0
	c0 = 0
	k = 0
	for j in range(n):
		A = input().split(' ')
		p = int(A[0])
		c = int(A[1])
		if p - p0 < 0 or c - c0 < 0 or p - p0 < c - c0:
			k += 1
		p0 = p
		c0 = c
	if k == 0:
		res.append('YES')
	else:
		res.append('NO')
for i in range(T):
	print(res[i])


t = int(input())
for _ in range(t):
	n = int(input())
	(a, b) = map(int, input().split())
	flg_correct = True
	if b > a:
		flg_correct = False
	for i in range(1, n):
		(c, d) = map(int, input().split())
		if d <= c and c >= a and (d >= b) and (d - b <= c - a):
			flg_correct = flg_correct
		else:
			flg_correct = False
		(a, b) = (c, d)
	if flg_correct:
		print('YES')
	else:
		print('NO')


t = int(input())
for case in range(t):
	n = int(input())
	data = []
	for line in range(n):
		(plays, clears) = map(int, input().split())
		data.append((plays, clears))
	last_plays = -1
	last_clears = -1
	for (plays, clears) in data:
		if last_plays > plays or last_clears > clears or clears > plays or (last_plays - last_clears > plays - clears):
			print('NO')
			break
		last_plays = plays
		last_clears = clears
	else:
		print('YES')


for _ in range(int(input())):
	N = int(input())
	lis = []
	flag = 0
	maxp = maxc = 0
	for i in range(N):
		lis.append([int(x) for x in input().split()])
	for i in lis:
		p = i[0]
		c = i[1]
		if c > p or p < maxp or c < maxc or (p - c < maxp - maxc):
			flag = 1
			break
		maxp = p
		maxc = c
	print('NO' if flag else 'YES')


t = int(input())
for _ in range(t):
	n = int(input())
	pre_p = -1
	pre_c = -1
	flag = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if i != 0:
			if p >= pre_p and c >= pre_c and (p - pre_p >= c - pre_c):
				pass
			else:
				flag = False
		if i == 0:
			if p >= c:
				pass
			else:
				flag = False
		pre_p = p
		pre_c = c
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
decir = []
for i in range(0, t):
	c = int(input())
	played = []
	cleared = []
	for j in range(0, c):
		d = input()
		played.append(int(d.split(' ')[0]))
		cleared.append(int(d.split(' ')[1]))
	estado = 'idle'
	if c == 1:
		if cleared > played:
			estado = 'NO'
		else:
			estado = 'YES'
	if c > 1:
		for z in range(0, c - 1):
			if estado != 'NO':
				if cleared[z + 1] - cleared[z] < 0:
					estado = 'NO'
				elif played[z] - cleared[z] < 0:
					estado = 'NO'
				elif played[z + 1] - played[z] < 0:
					estado = 'NO'
				elif played[z + 1] - played[z] - (cleared[z + 1] - cleared[z]) < 0:
					estado = 'NO'
				else:
					estado = 'YES'
	print(estado)


t = int(input())
for i in range(t):
	n = int(input())
	flag = True
	(a_0, b_0) = list(map(int, input().split()))
	(a_1, b_1) = (0, 0)
	if b_0 > a_0:
		flag = False
	for j in range(n - 1):
		(a_1, b_1) = list(map(int, input().split()))
		if (b_1 < b_0 or a_1 < a_0) or (b_1 > b_0 and a_1 == a_0) or b_1 > a_1 or (b_1 - b_0 > a_1 - a_0):
			flag = False
		(a_0, b_0) = (a_1, b_1)
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	(l1, l2) = (0, 0)
	f = 1
	for j in range(n):
		(a, b) = map(int, input().split())
		if not (a >= b and a >= l1 and (b >= l2)):
			f = 0
		if a - l1 < b - l2:
			f = 0
		l1 = a
		l2 = b
	if f == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for q in range(t):
	n = int(input())
	mas = []
	flag = 1
	for i in range(n):
		(x, y) = map(int, input().split())
		mas.append([x, y])
		if x < y:
			flag = 0
	for i in range(n - 1):
		if mas[i][0] - mas[i][1] > mas[i + 1][0] - mas[i + 1][1]:
			flag = 0
		if mas[i] != mas[i + 1] and (mas[i][0] >= mas[i + 1][0] or mas[i][1] > mas[i + 1][1]):
			flag = 0
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	pp = -1
	pc = -1
	f = 1
	for k in range(n):
		(a, b) = map(int, input().split())
		if f == 1 and pp == -1 and (pc == -1):
			if a < b:
				print('NO')
				f = 0
			pp = a
			pc = b
		else:
			if f == 1 and (a < pp or b < pc):
				print('NO')
				f = 0
			if f == 1 and a == pp and (pc - b != 0):
				print('NO')
				f = 0
			if f == 1 and a - pp < b - pc:
				print('NO')
				f = 0
		pp = a
		pc = b
	if f == 1:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	ar1 = []
	ar2 = []
	for i in range(n):
		(a, b) = map(int, input().split())
		ar1.append(a)
		ar2.append(b)
		flagg = 0
	for j in range(n - 1):
		if ar2[j + 1] >= ar2[j] and ar1[j + 1] >= ar1[j] and (ar1[j] >= ar2[j]) and (ar1[j + 1] - ar1[j] >= ar2[j + 1] - ar2[j]):
			flagg = 0
		else:
			flagg = 1
			break
	if ar1[-1] < ar2[-1]:
		flagg = 1
	if flagg == 0:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	(last_a, last_b) = (0, 0)
	ans = True
	for _ in range(n):
		(a, b) = [int(x) for x in input().split()]
		if ans:
			diff_a = a - last_a
			diff_b = b - last_b
			if diff_a >= diff_b >= 0:
				last_a = a
				last_b = b
				continue
			else:
				ans = False
	if ans:
		print('YES')
	else:
		print('NO')


import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt, ceil
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)
t = int(input())
for i in range(t):
	n = int(input())
	p = [0 for i in range(n)]
	c = [0 for i in range(n)]
	yes = True
	for j in range(n):
		(p[j], c[j]) = map(int, input().split())
		if p[j] < c[j]:
			yes = False
		if j > 0:
			if p[j] < p[j - 1] or c[j] < c[j - 1] or p[j] - p[j - 1] < c[j] - c[j - 1]:
				yes = False
	if yes:
		print('YES')
	else:
		print('NO')


t = int(input())
for tt in range(t):
	n = int(input())
	flag = 'YES'
	cur_p = 0
	cur_c = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if cur_p > p or c > p or p - cur_p < c - cur_c or (cur_c > c):
			flag = 'NO'
		else:
			cur_p = p
			cur_c = c
	print(flag)


from functools import reduce
import sys

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(delimiter=' '):
		return input().split(delimiter)

	@staticmethod
	def list_int(delimiter=' '):
		return list(map(int, input().split(delimiter)))

def main():
	t = Read.int()
	for _ in range(t):
		n = Read.int()
		flag = True
		p = []
		c = []
		for i in range(n):
			tmp = Read.list_int()
			p.append(tmp[0])
			c.append(tmp[1])
		if p[0] < c[0]:
			flag = False
		else:
			for i in range(1, len(p)):
				if p[i] < c[i] or p[i] < p[i - 1] or c[i] < c[i - 1] or (c[i] > c[i - 1] and p[i] == p[i - 1] or c[i] - c[i - 1] > p[i] - p[i - 1]):
					flag = False
		if flag:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	p1 = 0
	c1 = 0
	tf = True
	for _ in range(n):
		(p, c) = map(int, input().split())
		if c >= c1:
			if p - p1 >= c - c1:
				p1 = p
				c1 = c
			else:
				tf = False
		else:
			tf = False
	if tf:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(0, a):
	b = int(input())
	plays = []
	clears = []
	for i in range(0, b):
		arr = list(map(int, input().split()))
		plays.append(arr[0])
		clears.append(arr[1])
	k = 0
	plays.insert(0, 0)
	clears.insert(0, 0)
	for i in range(0, len(plays) - 1):
		if plays[i + 1] - plays[i] < clears[i + 1] - clears[i]:
			k = 1
			break
		if plays[i + 1] < plays[i]:
			k = 1
			break
		if clears[i + 1] < clears[i]:
			k = 1
			break
	if k == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	(pp, cc) = (0, 0)
	flag = True
	for i in range(n):
		line = input().split()
		(p, c) = (int(line[0]), int(line[1]))
		if p < pp or c < cc or c > p or (c - cc > p - pp):
			flag = False
		(pp, cc) = (p, c)
	if flag:
		print('YES')
	else:
		print('NO')
	t -= 1


import sys
t = int(input())
inp = [line.strip().split() for line in reversed(sys.stdin.readlines())]
while t:
	n = int(inp.pop()[0])
	c = [-1] * n
	p = [-1] * n
	prevp = 0
	prevc = 0
	wrong_flag = False
	for i in range(n):
		(p, c) = map(int, inp.pop())
		if c - prevc > p - prevp or c < prevc or p < prevp or (c > p):
			wrong_flag = True
		prevp = p
		prevc = c
	if wrong_flag:
		print('NO')
	else:
		print('YES')
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	(p1, c1) = (-1, -1)
	b = True
	for j in range(n):
		(p, c) = map(int, input().split())
		if p - p1 < c - c1 or (p < p1 and p1 != -1) or (c < c1 and c1 != -1):
			b = False
		else:
			(p1, c1) = (p, c)
	if b:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = [tuple(map(int, input().split())) for _ in range(n)]
	(a, b) = (0, 0)
	err = False
	for (c, d) in arr:
		if c - a < d - b or c < a or d < b:
			err = True
			break
		(a, b) = (c, d)
	if err:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	lst1 = []
	lst2 = []
	for j in range(n):
		(a, b) = input().split()
		a = int(a)
		b = int(b)
		lst1.append(a)
		lst2.append(b)
	count = 0
	if lst2[0] > lst1[0]:
		print('NO')
	else:
		count += 1
		for j in range(1, n):
			if lst1[j] < lst1[j - 1]:
				print('NO')
				break
			elif lst2[j] < lst2[j - 1]:
				print('NO')
				break
			elif lst1[j] == lst1[j - 1] and lst2[j] > lst2[j - 1]:
				print('NO')
				break
			elif lst1[j] > lst1[j - 1] and lst2[j] > lst2[j - 1]:
				x = lst1[j] - lst1[j - 1]
				y = lst2[j] - lst2[j - 1]
				if y > x:
					print('NO')
					break
				else:
					count += 1
			else:
				count += 1
	if count == n:
		print('YES')


def main():
	for _ in inputt():
		flag = True
		p = c = 0
		for _ in inputt():
			(np, nc) = inputi()
			if not flag:
				continue
			if np < nc or np < p or nc < c:
				flag = False
			elif np - p < nc - c:
				flag = False
			(p, c) = (np, nc)
		if flag:
			print('YES')
		else:
			print('NO')
import sys, io, os
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	for x in args:
		file.write(str(x))
	file.write(kwargs.pop('end', '\n'))
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
inputt = lambda t=0: range(t) if t else range(int(input()))
inputi = lambda : map(int, input().split())
inputl = lambda : list(inputi())
from math import *
from heapq import *
from bisect import *
from itertools import *
from functools import reduce, lru_cache
from collections import Counter, defaultdict
import re, copy, operator, cmath
from builtins import *
main()


for _ in range(int(input())):
	n = int(input())
	lst = []
	for __ in range(n):
		lst.append(list(map(int, input().split())))
	if n == 1 and lst[0][0] >= lst[0][1]:
		print('YES')
	elif n == 1 and lst[0][0] < lst[0][1]:
		print('NO')
	else:
		for i in range(n - 1):
			if lst[i][0] > lst[i + 1][0]:
				print('NO')
				break
			elif lst[i][0] == lst[i + 1][0] and lst[i][1] < lst[i + 1][1]:
				print('NO')
				break
			elif lst[i][1] > lst[i + 1][1]:
				print('NO')
				break
			elif lst[i][0] < lst[i][1]:
				print('NO')
				break
			elif i == n - 2 and lst[i + 1][0] < lst[i + 1][1]:
				print('NO')
				break
			elif abs(lst[i][0] - lst[i + 1][0]) < abs(lst[i][1] - lst[i + 1][1]):
				print('NO')
				break
			elif i == n - 2:
				print('YES')


t = int(input())
while t:
	n = int(input())
	l = []
	p = 0
	c = 0
	c1 = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		l.append([a, b])
	for i in range(n):
		if l[i][0] < p:
			c1 = 1
			break
		if l[i][1] < c:
			c1 = 1
			break
		if abs(l[i][1] - c) > abs(l[i][0] - p):
			c1 = 1
			break
		p = l[i][0]
		c = l[i][1]
	if c1 == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


from collections import defaultdict
from math import *
t = int(input())
for k in range(t):
	n = int(input())
	a = []
	for i in range(n):
		a.append([int(el) for el in input().split()])
	bad = False
	if a[0][1] > a[0][0]:
		bad = True
	for i in range(1, n):
		if a[i][0] < a[i][1]:
			bad = True
		if a[i][0] < a[i - 1][0] or a[i][1] < a[i - 1][1]:
			bad = True
		if a[i][1] - a[i - 1][1] > a[i][0] - a[i - 1][0]:
			bad = True
	if bad:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	flag = 1
	p_base = 0
	c_base = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < p_base or c < c_base:
			flag = 0
		if p - p_base < c - c_base:
			flag = 0
		(p_base, c_base) = (p, c)
	print('YES' if flag else 'NO')


for t in range(int(input())):
	n = int(input())
	al = 0
	good = 0
	ans = 'YES'
	for i in range(n):
		(newall, newgood) = map(int, input().split())
		if newall < al or newgood < good:
			ans = 'NO'
		if newall - al < newgood - good:
			ans = 'NO'
		(al, good) = (newall, newgood)
	print(ans)


from sys import stdin
for __ in range(int(stdin.readline())):
	n = int(stdin.readline())
	ans = 1
	a = 0
	b = 0
	for i in range(n):
		(x, y) = list(map(int, stdin.readline().split()))
		if ans:
			if x < y or x < a or y < b:
				ans = 0
			if y - b > x - a:
				ans = 0
		(a, b) = (x, y)
	if ans:
		print('YES')
	else:
		print('NO')


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	liste = [list(map(int, sys.stdin.readline().split())) for i in range(n)]
	out = 'YES'
	if liste[0][0] < liste[0][1]:
		out = 'NO'
	for i in range(1, n):
		if liste[i][0] < liste[i - 1][0] or liste[i][1] < liste[i - 1][1] or liste[i][1] - liste[i - 1][1] > liste[i][0] - liste[i - 1][0] or (liste[i][0] < liste[i][1]):
			out = 'NO'
			break
	print(out)


t = int(input())
while t:
	flag = True
	n = int(input())
	pp = -1
	pc = -1
	for _ in range(n):
		(p, c) = map(int, input().split())
		if p - c >= 0 and p - pp >= 0 and (c - pc >= 0) and (p - pp - (c - pc) >= 0):
			pass
		else:
			flag = False
		(pp, pc) = (p, c)
	if flag:
		print('YES')
	else:
		print('NO')
	t -= 1


def solve(n, a):
	p = a[0][0]
	c = a[0][1]
	for el in a:
		if el[0] < p or el[1] < c:
			return 'NO'
		if el[0] < el[1]:
			return 'NO'
		if el[0] - p < el[1] - c:
			return 'NO'
		p = el[0]
		c = el[1]
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	a = list()
	for _ in range(n):
		a.append(list(map(int, input().split())))
	result = solve(n, a)
	print(result)


T = int(input())
for _ in range(T):
	n = int(input())
	(P, C) = (0, 0)
	res = 'YES'
	for _ in range(n):
		(p, c) = map(int, input().split())
		if p < P or c < C or p - P < c - C:
			res = 'NO'
		(P, C) = (p, c)
	print(res)


for _ in range(int(input())):
	n = int(input())
	ok = True
	plays = 0
	wins = 0
	for i in range(n):
		(p, w) = map(int, input().split())
		if w - wins > p - plays or w < wins or p < plays:
			ok = False
		plays = p
		wins = w
	if ok:
		print('YES')
	else:
		print('NO')


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	N = Scanner.int()
	(P, C) = ([0 for _ in range(N)], [0 for _ in range(N)])
	for i in range(N):
		(P[i], C[i]) = Scanner.map_int()
	s = set()
	(p, c) = (0, 0)
	for i in range(N):
		for a in s:
			if a[0] == P[i] and a[1] != C[i]:
				return False
		if P[i] < p:
			return False
		if C[i] < c:
			return False
		if c + (P[i] - p) < C[i]:
			return False
		p = P[i]
		c = C[i]
		s.add((P[i], C[i]))
	return True

def main():
	T = Scanner.int()
	for _ in range(T):
		print('YNEOS'[not solve()::2])
main()


for _ in range(int(input())):
	n = int(input())
	b = True
	p = 0
	c = 0
	for i in range(n):
		(p_, c_) = map(int, input().split())
		if p_ < p or c + (p_ - p) < c_ or c_ < c:
			b = False
		else:
			(p, c) = (p_, c_)
	print('YES' if b else 'NO')


for t in range(int(input())):
	n = int(input())
	plays = 0
	clear = 0
	f_p = 0
	f_c = 0
	k = 1
	for i in range(n):
		(p, c) = map(int, input().split())
		plays += p
		clear += c
		ans_o = p - f_p
		ans_t = c - f_c
		if ans_o < 0 or ans_t < 0 or ans_o < ans_t:
			k = 0
		f_p = p
		f_c = c
	else:
		if clear > plays or not k:
			print('NO')
		else:
			print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	(l, r) = (0, 0)
	w = [[int(k) for k in input().split()] for v in range(n)]
	for j in range(n):
		(p, c) = w[j]
		if p >= l and c >= r and (p - l >= c - r):
			pass
		else:
			print('NO')
			break
		(l, r) = (p, c)
	else:
		print('YES')


N = int(input())
for i in range(N):
	n = int(input())
	plays = []
	clears = []
	flag = 0
	for j in range(n):
		P_C = list(input().split())
		plays.append(int(P_C[0]))
		clears.append(int(P_C[1]))
		if len(plays) != 1:
			if plays[j] < plays[j - 1] or clears[j] < clears[j - 1]:
				flag = 1
			elif plays[j] == plays[j - 1] and clears[j] != clears[j - 1]:
				flag = 1
			elif plays[j] - plays[j - 1] < clears[j] - clears[j - 1]:
				flag = 1
		if plays[j] < clears[j]:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for tt in range(t):
	n = int(input())
	(x, y) = map(int, input().split())
	b = y <= x
	for i in range(n - 1):
		(p, c) = map(int, input().split())
		if p - x < c - y or c < y or p < x:
			b = False
		(x, y) = (p, c)
	print('YES' if b else 'NO')


from sys import stdin
input = stdin.readline
for ti in range(int(input().strip())):
	n = int(input().strip())
	(pp, cp) = (-1, -1)
	valid = True
	for ni in range(n):
		(pi, ci) = [int(x) for x in input().strip().split()]
		if pi - pp < ci - cp or pi < pp or ci < cp:
			valid = False
		(pp, cp) = (pi, ci)
	if not valid:
		print('No')
	else:
		print('Yes')


import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__

def go():
	n = int(input())
	git = True
	(pp, cc) = (0, 0)
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < pp or c < cc or p - pp < c - cc:
			git = False
		(pp, cc) = (p, c)
	return ['NO', 'YES'][git]
t = int(input())
ans = []
for _ in range(t):
	ans.append(str(go()))
print('\n'.join(ans))


for _ in range(int(input())):
	n = int(input())
	(flag, p, c) = (True, 0, 0)
	for _ in range(n):
		(x, y) = [int(i) for i in input().split()]
		if x < p or y < c or y - c > x - p:
			flag = False
		(p, c) = (x, y)
	print('YES' if flag else 'NO')


t = int(input())
l = []
for i in range(t):
	n = int(input())
	ku = 0
	kp = 0
	r = 1
	for j in range(n):
		(p, c) = map(int, input().split())
		if kp > p or ku > c:
			if r != 0:
				l.append('NO')
				r = 0
		elif c - ku > p - kp:
			if r != 0:
				l.append('NO')
				r = 0
		kp = p
		ku = c
	if r:
		l.append('YES')
for i in l:
	print(i)


def solve(ans):
	n = int(input())
	li = []
	for i in range(n):
		temp = [int(x) for x in input().split()]
		li.append(temp)
	(plays, clears) = (0, 0)
	for i in range(n):
		if li[i][0] - plays < li[i][1] - clears:
			ans.append('NO')
			break
		if li[i][0] < li[i][1]:
			ans.append('NO')
			break
		if li[i][0] < plays:
			ans.append('NO')
			break
		if li[i][1] < clears:
			ans.append('NO')
			break
		(plays, clears) = (li[i][0], li[i][1])
	else:
		ans.append('YES')
t = int(input())
ans = []
for i in range(t):
	solve(ans)
for ele in ans:
	print(ele)


for _ in range(int(input())):
	n = int(input())
	l = []
	f = 0
	for i in range(n):
		c = list(map(int, input().split()))
		if c[1] > c[0]:
			f = 1
		if len(l) > 0:
			if c[0] == l[0][0] and c[1] > l[0][1] or (c[0] < l[0][0] or c[1] < l[0][1]):
				f = 1
			if c[0] > l[0][0] and c[1] > l[0][1]:
				if c[0] - l[0][0] < c[1] - l[0][1]:
					f = 1
			l.pop()
		l.append(c)
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	p = []
	for i in range(n):
		(p_i, c_i) = map(int, input().split())
		p.append([p_i, c_i])
	flag = 0
	for i in range(n):
		if p[i][0] < p[i][1]:
			flag = 1
			print('NO')
			break
	if not flag:
		for i in range(1, n):
			dif = p[i][0] - p[i - 1][0]
			if p[i][1] > p[i - 1][1] + dif or p[i][1] < p[i - 1][1]:
				flag = 1
				print('NO')
				break
	if not flag:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	pp = 0
	cp = 0
	flg = True
	for i in range(n):
		(p, c) = [int(x) for x in input().split()]
		dp = p - pp
		dc = c - cp
		if c > p:
			flg = False
		elif dp < 0 or dc < 0:
			flg = False
		elif dc > dp:
			flg = False
		pp = p
		cp = c
	if flg:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	ans = 'YES'
	(p, c) = map(int, input().split())
	if c > p:
		ans = 'NO'
	for j in range(n - 1):
		(pnew, cnew) = map(int, input().split())
		if pnew < p or cnew < c or cnew > pnew or (cnew - c > pnew - p):
			ans = 'NO'
		(p, c) = (pnew, cnew)
	print(ans)


def correct(lista, n):
	for j in range(n - 1):
		d1 = lista[j + 1][0] - lista[j][0]
		d2 = lista[j + 1][1] - lista[j][1]
		if lista[j][0] < lista[j][1]:
			return False
		if d1 < 0 or d2 < 0:
			return False
		elif d1 < d2:
			return False
	if lista[0][0] < lista[0][1]:
		return False
	return True
t = int(input())
for i in range(t):
	n = int(input())
	lista = []
	for j in range(n):
		(x, y) = input().split()
		x = int(x)
		y = int(y)
		lista += [[x, y]]
	if correct(lista, n):
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	P = []
	C = []
	for i in range(n):
		(p, c) = map(int, input().split())
		P.append(p)
		C.append(c)
	for i in range(n):
		if C[i] > P[i]:
			print('NO')
			break
		if i < n - 1 and (C[i + 1] - C[i] > P[i + 1] - P[i] or C[i] > C[i + 1]):
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	pp = 0
	pc = 0
	fail = False
	for i in range(n):
		(p, c) = list(map(int, input().split()))
		dp = p - pp
		dc = c - pc
		if dc > dp or dp < 0 or dc < 0:
			fail = True
		pp = p
		pc = c
	print('NO' if fail else 'YES')


for T in range(int(input())):
	(p, c, d) = (0, 0, 0)
	flag = True
	for n in range(int(input())):
		(x, y) = [int(i) for i in input().split()]
		if x >= p and y >= c and (x - y >= p - c):
			p = x
			c = y
			d = p - c
		else:
			flag = False
	print(['NO', 'YES'][flag])


for _ in range(int(input())):
	n = int(input())
	ans = 'YES'
	(a, b) = map(int, input().split())
	if a < b:
		ans = 'NO'
	for __ in range(n - 1):
		(a1, b1) = map(int, input().split())
		if not (a1 >= a and b1 >= b and (a1 - a >= b1 - b)):
			ans = 'NO'
		(a, b) = (a1, b1)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	can = True
	prevp = 0
	prevc = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < c or p < prevp or c < prevc or (c - prevc > p - prevp):
			can = False
		prevp = p
		prevc = c
	if can:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	p = [0] * n
	c = [0] * n
	for j in range(n):
		(p[j], c[j]) = map(int, input().split())
	for j in range(n):
		if j == 0:
			if p[j] < c[j]:
				print('NO')
				break
			pass
		elif p[j] < c[j] or p[j] < p[j - 1] or c[j] < c[j - 1] or (p[j] - p[j - 1] < c[j] - c[j - 1]):
			print('NO')
			break
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	(a, b) = (0, 0)
	f = 0
	while n != 0:
		(c, d) = map(int, input().split())
		if c > a and b <= d <= b + c - a:
			a = c
			b = d
		elif c == a and b == d:
			pass
		else:
			f = 1
		n = n - 1
	if f == 0:
		print('YES')
	else:
		print('NO')


T = int(input())
list = []
c = -1
d = -1
for i in range(T):
	n = int(input())
	k = 'Yes'
	for j in range(n):
		(a, b) = map(int, input().split())
		if a >= b and c <= a and (d <= b) and (b - d <= a - c):
			g = 0
		else:
			k = 'No'
		c = a
		d = b
	c = -1
	d = -1
	list.append(k)
for i in range(len(list)):
	print(list[i])


def step1(s1):
	if s1[0] == 0:
		return 'YES'
	if s1[1] < s1[2]:
		return 'NO'
	if s1[0] == 1:
		return 'YES'
	for i in range(3, len(s1), 2):
		if s1[i] < s1[i - 2] or s1[i + 1] < s1[i - 1] or s1[i] - s1[i - 2] < s1[i + 1] - s1[i - 1]:
			return 'NO'
	return 'YES'
for _ in [0] * int(input()):
	n = int(input())
	b = [n]
	for _ in range(n):
		a = list(map(int, input().split()))
		b.append(a[0])
		b.append(a[1])
	print(step1(b))


t = int(input())
for j in range(t):
	n = int(input())
	p0 = 0
	c0 = 0
	out = 'YES'
	for i in range(n):
		(p, c) = tuple(map(int, input().split()))
		if c > p or p < p0 or c < c0 or (c - c0 > p - p0):
			out = 'NO'
		p0 = p
		c0 = c
	print(out)


gi = lambda : list(map(int, input().split()))
for _ in range(gi()[0]):
	(n,) = gi()
	l = [gi() for __ in range(n)]
	flag = True
	(p, c) = l[0]
	if c > p:
		flag = False
	for k in range(1, n):
		(p, c) = l[k]
		(pp, cc) = l[k - 1]
		if c < cc or p < pp:
			flag = False
			break
		elif c > cc:
			if c - cc > p - pp:
				flag = False
				break
	if flag:
		print('YES')
	else:
		print('NO')


def valid(n, list1, list2):
	if n == 1:
		if list1[0] < list2[0]:
			return 'NO'
		else:
			return 'YES'
	else:
		l1 = list1[:]
		l2 = list2[:]
		l1.sort()
		l2.sort()
		if l1 != list1 or l2 != list2:
			return 'NO'
		else:
			for i in range(n - 1):
				if list2[i + 1] > list2[i] and list1[i + 1] <= list1[i]:
					return 'NO'
				if list1[i] < list2[i] or list1[i + 1] < list2[i + 1]:
					return 'NO'
				if list1[i + 1] - list1[i] < list2[i + 1] - list2[i]:
					return 'NO'
			else:
				return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	plays = []
	clears = []
	for j in range(n):
		(x, y) = map(int, input().split())
		plays.append(x)
		clears.append(y)
	print(valid(n, plays, clears))


t = int(input())
for x in range(1, t + 1):
	n = int(input())
	check = True
	p = []
	c = []
	for i in range(0, n):
		s = input().split(' ')
		p.append(int(s[0]))
		c.append(int(s[1]))
	for i in range(0, n):
		if i == 0:
			if p[0] < c[0]:
				check = False
				break
		else:
			newP = p[i] - p[i - 1]
			newC = c[i] - c[i - 1]
			if newP < 0 or newC < 0 or newC > newP:
				check = False
				break
	if check:
		print('YES')
	else:
		print('NO')


import sys
t = int(input())

def analise(plays):
	play = plays.pop(0)
	if play[1] > play[0]:
		return 'NO'
	for _ in range(len(plays)):
		if plays[0][1] > plays[0][0] or plays[0][0] < play[0] or plays[0][1] < play[1] or (plays[0][1] - play[1] > plays[0][0] - play[0]):
			return 'NO'
		else:
			play = plays.pop(0)
	return 'YES'
for i in range(t):
	n = int(input())
	plays = []
	for j in range(n):
		ax = input().split()
		plays.append((int(ax.pop(0)), int(ax.pop(0))))
	print(analise(plays))


t = int(input())
while t:
	t = t - 1
	n = int(input())
	a = []
	for i in range(n):
		a.append([int(s) for s in input().split()])
	is_first_inceasing = 1
	is_second_increasing = 1
	is_sec_grater_one = 1
	flag = 1
	if a[0][0] < a[0][1]:
		is_sec_grater_one = 0
	for i in range(1, n):
		if a[i][0] < a[i - 1][0]:
			is_first_inceasing = 0
		if a[i][1] < a[i - 1][1]:
			is_second_increasing = 0
		if a[i][0] < a[i][1]:
			is_sec_grater_one = 0
		if a[i][1] > a[i - 1][1]:
			no_of_clear_inc = a[i][1] - a[i - 1][1]
			no_of_player_inc = a[i][0] - a[i - 1][0]
			if no_of_clear_inc > no_of_player_inc:
				flag = 0
	if is_first_inceasing and is_sec_grater_one and is_second_increasing and flag:
		print('YES')
	else:
		print('NO')


def check():
	n = int(input())
	good = 'YES'
	arr = []
	for i in range(n):
		(p, c) = map(int, input().split())
		if p == c or p > c:
			t1 = tuple([p, c])
			arr.append(t1)
		else:
			t1 = tuple([p, c])
			arr.append(t1)
			good = 'NO'
		if i > 0 and arr[i][0] < arr[i - 1][0]:
			good = 'NO'
		else:
			diff = arr[i][0] - arr[i - 1][0]
		if i > 0 and arr[i][1] < arr[i - 1][1]:
			good = 'NO'
		if i > 0 and arr[i][1] > diff + arr[i - 1][1]:
			good = 'NO'
	return good
for _ in range(int(input())):
	print(check())


from collections import Counter
from collections import defaultdict
import math
t = int(input())
for _ in range(0, t):
	n = int(input())
	a = []
	for i in range(0, n):
		a.append(list(map(int, input().split())))
	f = 1
	x = 0
	y = 0
	for i in range(0, n):
		if a[i][0] < a[i][1] or x > a[i][0] or y > a[i][1]:
			f = 0
		if x == a[i][0] and y != a[i][1]:
			f = 0
		if abs(x - a[i][0]) < abs(y - a[i][1]):
			f = 0
		x = a[i][0]
		y = a[i][1]
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	(a, b) = (-1, -1)
	impossible = False
	for j in range(n):
		(p, c) = map(int, input().split(' '))
		if a > p or b > c:
			impossible = True
		if p - a < c - b:
			impossible = True
		(a, b) = (p, c)
	ans = ['YES', 'NO']
	print(ans[impossible])


t = int(input())
for _ in range(t):
	n = int(input())
	p = []
	c = []
	for __ in range(n):
		(a, b) = list(map(int, input().split()))
		p.append(a)
		c.append(b)
	p_i = p[0]
	c_i = c[0]
	flag = 1
	if p[0] >= c[0]:
		for i in range(1, n):
			if p[i] >= p_i and c[i] >= c_i:
				if p[i] - p[i - 1] >= c[i] - c[i - 1]:
					pass
				else:
					flag = 0
					break
			else:
				flag = 0
				break
			p_i = p[i]
			c_i = c[i]
	else:
		flag = 0
	if flag == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
while t:
	t = t - 1
	(x, y) = (0, 0)
	m = list(map(int, input().split(' ')))[0]
	flag = 0
	while m:
		m = m - 1
		(p, c) = list(map(int, input().split(' ')))
		a = p - x
		b = c - y
		if a >= 0:
			if b >= 0:
				if a >= b:
					x = p
					y = c
					flag = 1
				else:
					flag = 0
					break
			else:
				flag = 0
				break
		else:
			flag = 0
			break
	while m:
		m = m - 1
		(p, c) = list(map(int, input().split(' ')))
	if flag == 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	(x, y) = map(int, input().split())
	f = 1
	if x < y:
		f = 0
	for _ in range(n - 1):
		(x1, y1) = map(int, input().split())
		if y1 >= y and x1 >= x and (x1 - x >= y1 - y):
			pass
		else:
			f = 0
		y = y1
		x = x1
	if f == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	for i in range(n):
		a.append(list(map(int, input().split())))
	e = 0
	if a[0][0] < a[0][1]:
		e = 1
	for i in range(1, n):
		if a[i][0] < a[i][1]:
			e = 1
			break
		if a[i][0] - a[i - 1][0] < a[i][1] - a[i - 1][1]:
			e = 1
			break
		if a[i][0] < a[i - 1][0] or a[i][1] < a[i - 1][1]:
			e = 1
			break
	if e == 1:
		print('NO')
	else:
		print('YES')


for t in range(int(input())):
	n = int(input())
	(q, d) = (0, 0)
	s = 'YES'
	for i in range(n):
		(p, c) = map(int, input().split())
		if 0 > min(c - d, p - q, p - q - c + d):
			s = 'NO'
		(q, d) = (p, c)
	print(s)


test = int(input())
while test:
	test -= 1
	n = int(input())
	flag = True
	p = 0
	c = 0
	for i in range(n):
		(p1, c1) = map(int, input().split())
		if p > p1 or c1 > p1 or c1 < c:
			flag = False
		if p == p1 and c != c1:
			flag = False
		if abs(p1 - p) < abs(c1 - c):
			flag = False
		p = p1
		c = c1
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	stats = []
	possible = True
	for k in range(n):
		stats.append(tuple(map(int, input().split())))
	if stats[0][1] > stats[0][0]:
		print('NO')
		continue
	if n == 1:
		print('YES')
		continue
	else:
		for i in range(1, n):
			if stats[i][0] < stats[i - 1][0] or stats[i][1] < stats[i - 1][1]:
				possible = False
				break
			elif stats[i][0] - stats[i - 1][0] < stats[i][1] - stats[i - 1][1]:
				possible = False
				break
		print('YNEOS'[not possible::2])


def soln(stats):
	for (plays, clears) in stats:
		if clears > plays:
			return False
	for i in range(len(stats) - 1):
		clearDiff = stats[i + 1][1] - stats[i][1]
		if not (stats[i + 1][0] - stats[i][0] >= clearDiff and all((stats[i + 1][j] >= stats[i][j] for j in range(2)))):
			return False
	return True

def main():
	T = int(input())
	for _ in range(T):
		n = int(input())
		stats = []
		for _ in range(n):
			stats.append([int(x) for x in input().split(' ')])
		print('YES' if soln(stats) == True else 'NO')

def test():
	stats = []
main()


for _ in ' ' * int(input()):
	z = 0
	y = 0
	n = 0
	for _ in ' ' * int(input()):
		(a, b) = map(int, input().split())
		if a < b:
			n = 1
		elif a < z or b < y or a - z < b - y:
			n = 1
		elif a == z and b != y:
			n = 1
		z = a
		y = b
	print('no' if n else 'yes')


t = int(input())
for _ in range(t):
	n = int(input())
	s = [[0, 0] for i in range(n)]
	for i in range(n):
		s[i] = [int(d) for d in input().split()]
	p = s[0][0]
	c = s[0][1]
	if p < c:
		print('NO')
		continue
	o = False
	for i in range(1, n):
		np = s[i][0]
		nc = s[i][1]
		dp = np - p
		dc = nc - c
		if dp < 0 or dc < 0 or dp < dc:
			print('NO')
			o = True
			break
		p = np
		c = nc
	if o:
		continue
	print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a2 = -1
	c2 = -1
	l = 1
	for j in range(n):
		(p, c) = map(int, input().split())
		if c > p or a2 > p or c2 > c:
			l = 2
		if c - c2 > p - a2:
			l = 2
		a2 = p
		c2 = c
	if l == 2:
		print('NO')
	else:
		print('YES')


test = int(input())
for _ in range(test):
	n = int(input())
	alist = [list(map(int, input().split())) for _ in range(n)]
	ans = 'YES'
	if n == 1 and alist[-1][0] >= alist[-1][1]:
		print(ans)
		continue
	elif n == 1:
		print('NO')
		continue
	for i in range(n - 1):
		if alist[i + 1][0] - alist[i][0] < alist[i + 1][1] - alist[i][1] or alist[i + 1][0] < alist[i][0] or alist[i + 1][1] < alist[i][1] or (alist[i][0] < alist[i][1]):
			ans = 'NO'
			break
	print(ans)


def main():
	n = int(input())
	pc = [list(map(int, input().split())) for _ in range(n)]
	if pc[0][1] > pc[0][0]:
		return False
	for i in range(n - 1):
		f = pc[i]
		s = pc[i + 1]
		if f[0] > s[0] or f[1] > s[1] or s[0] - f[0] < s[1] - f[1]:
			return False
	return True
for i in range(int(input())):
	if main():
		print('Yes')
	else:
		print('No')


def check(p, c, n):
	if n == 1:
		if p[0] >= c[0]:
			return 'YES'
		else:
			return 'NO'
	for i in range(n - 1):
		if p[i] >= c[i] and p[i + 1] >= p[i] and (c[i + 1] >= c[i]) and (p[i + 1] >= c[i + 1]):
			if p[i + 1] >= p[i] + (c[i + 1] - c[i]):
				continue
			else:
				return 'NO'
		else:
			return 'NO'
	return 'YES'
for j in range(int(input())):
	n = int(input())
	player = []
	clear = []
	for i in range(n):
		(a, b) = map(int, input().split())
		player.append(a)
		clear.append(b)
	v = check(player, clear, n)
	print(v)


t = int(input())
for f in range(t):
	n = int(input())
	p = 0
	c = 0
	po = 1
	for i in range(n):
		(p1, c1) = map(int, input().split())
		if c1 - c > p1 - p or p1 < p or c1 < c:
			po = 0
		(p, c) = (p1, c1)
	if po == 0:
		print('NO')
	else:
		print('YES')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		aa = [LI() for _ in range(n)]
		f = True
		b = c = 0
		for (d, e) in aa:
			t = d - b
			if d < e or b > d or c > e or (d - b < e - c):
				f = False
				break
			(b, c) = (d, e)
		rr.append(IF(f, 'YES', 'NO'))
	return JA(rr, '\n')
print(main())


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = [None] * T
for qu in range(T):
	N = int(readline())
	PC = [tuple(map(int, readline().split())) for _ in range(N)]
	(P, C) = map(list, zip(*PC))
	if any((c2 < c1 for (c1, c2) in zip(C, C[1:]))):
		Ans[qu] = 'NO'
		continue
	Pd = [p - c for (p, c) in PC]
	if any((p < 0 for p in Pd)) or any((p2 < p1 for (p1, p2) in zip(Pd, Pd[1:]))):
		Ans[qu] = 'NO'
		continue
	Ans[qu] = 'YES'
print('\n'.join(Ans))


from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from collections import defaultdict as dd, deque

def data():
	return sys.stdin.readline().strip()

def mdata():
	return map(int, data().split())
for i in range(int(data())):
	n = int(data())
	(a, b) = (0, 0)
	flag = True
	for i in range(n):
		(p, c) = mdata()
		if p < a or c < b or c > p or (c > p - a + b):
			flag = False
		a = p
		b = c
	if flag == False:
		print('NO')
	else:
		print('YES')


import sys

def main():
	t = int(input())
	for _ in range(t):
		n = int(sys.stdin.readline().strip())
		flag = True
		tempP = None
		tempC = None
		for i in range(n):
			(p, c) = map(int, sys.stdin.readline().split())
			if not flag:
				continue
			else:
				if p < c:
					flag = False
					continue
				if tempP == None:
					tempP = p
					tempC = c
				elif p - tempP < c - tempC or p < tempP or c < tempC:
					flag = False
					continue
				else:
					tempC = c
					tempP = p
		if flag:
			print('YES')
		else:
			print('NO')
	return
main()


for _ in range(int(input())):
	n = int(input())
	x = 0
	y = 0
	ch = 0
	l = []
	for i in range(n):
		(p, c) = map(int, input().split())
		l.append([p, c])
	for i in l:
		p = i[0]
		c = i[1]
		if p - x < c - y:
			print('NO')
			ch = 1
			break
		if p >= x and c >= y:
			if c > p:
				print('NO')
				ch = 1
				break
		else:
			print('NO')
			ch = 1
			break
		x = p
		y = c
	if ch == 0:
		print('YES')


def func(arr):
	if arr[0][1] > arr[0][0]:
		print('NO')
		return
	for i in range(1, len(arr)):
		if arr[i][0] < arr[i - 1][0] or arr[i][1] > arr[i][0] or arr[i][0] - arr[i - 1][0] < arr[i][1] - arr[i - 1][1] or (arr[i][1] < arr[i - 1][1]):
			print('NO')
			return
	print('YES')
k = int(input())
for p in range(k):
	n = int(input())
	array = []
	for j in range(n):
		array.append(list(map(int, input().split())))
	func(array)


def RA():
	l = input().split()
	return [int(s) for s in l]

def solve():
	n = int(input())
	records = []
	for i in range(n):
		records.append(RA())
	for r in records:
		if r[0] < r[1]:
			print('NO')
			return
	for i in range(1, n):
		if records[i][0] < records[i - 1][0] or records[i][1] < records[i - 1][1]:
			print('NO')
			return
		if records[i][0] - records[i - 1][0] < records[i][1] - records[i - 1][1]:
			print('NO')
			return
	print('YES')
t = int(input())
while t > 0:
	solve()
	t -= 1


t = int(input())
for q in range(t):
	n = int(input())
	vetor = []
	flag = True
	for k in range(n):
		entrada = list(map(int, input().split(' ')))
		vetor.append(entrada)
	if vetor[0][0] < vetor[0][1]:
		print('NO')
	else:
		for i in range(1, n):
			if vetor[i][0] < vetor[i - 1][0] or vetor[i][1] < vetor[i - 1][1] or (vetor[i][0] == vetor[i - 1][0] and vetor[i][1] != vetor[i - 1][1]) or (vetor[i][0] - vetor[i - 1][0] < vetor[i][1] - vetor[i - 1][1]):
				flag = False
				break
		if flag == False:
			print('NO')
		else:
			print('YES')


x = int(input())
for i in range(x):
	n = int(input())
	vetor = [[0, 0] for a in range(n)]
	flag = True
	anteriorP = 0
	anteriorS = 0
	for a in range(n):
		b = list(map(int, input().split(' ')))
		if b[0] < anteriorP:
			flag = False
		elif b[1] < anteriorS:
			flag = False
		elif b[1] > b[0]:
			flag = False
		elif b[1] - anteriorS > b[0] - anteriorP:
			flag = False
		else:
			anteriorP = b[0]
			anteriorS = b[1]
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	p = [0]
	c = [0]
	l = []
	flag = 1
	for i in range(1, n + 1):
		l = [int(x) for x in input().split()]
		p.append(l[0])
		c.append(l[1])
		if 0 > min(p[i] - p[i - 1], c[i] - c[i - 1], p[i] - p[i - 1] - c[i] + c[i - 1]):
			flag = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for T in range(t):
	n = int(input())
	L_prec = [0, 0]
	giusto = True
	for N in range(n):
		L = list(map(int, input().split()))
		if L[0] >= L_prec[0] and L[1] >= L_prec[1]:
			if L[1] - L_prec[1] > L[0] - L_prec[0]:
				print('NO')
				giusto = False
				break
			else:
				L_prec = []
				for x in L:
					L_prec.append(x)
				L = []
		else:
			print('NO')
			giusto = False
			break
	if giusto:
		print('YES')
	for x in range(n - 1 - N):
		L = list(map(int, input().split()))


t = int(input())
for _ in range(t):
	n = int(input())
	pre_plays = 0
	pre_clr = 0
	s = 0
	for _ in range(n):
		(pi, ci) = map(int, input().split())
		if pi >= pre_plays and ci >= pre_clr and (pi - pre_plays >= ci - pre_clr):
			pre_plays = pi
			pre_clr = ci
		else:
			s += 1
	if s == 0:
		print('YES')
	else:
		print('NO')


def solve(a):
	(prev_pl, prev_cl) = (0, 0)
	for (pl, cl) in a:
		if pl < prev_pl or cl < prev_cl or cl > pl:
			return False
		elif cl - prev_cl > pl - prev_pl:
			return False
		prev_pl = pl
		prev_cl = cl
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	for _ in range(n):
		(pl, cl) = map(int, input().split())
		a.append((pl, cl))
	if solve(a):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	f = 0
	lst1 = []
	lst2 = []
	n = int(input())
	for j in range(n):
		(a, b) = map(int, input().split())
		lst1.append(a)
		lst2.append(b)
	if lst1[0] < lst2[0]:
		f = 1
		print('NO')
	else:
		m1 = lst1[0]
		m2 = lst2[0]
		for j in range(1, n):
			if lst1[j] < m1 or lst2[j] > lst1[j] or lst2[j] - lst2[j - 1] > lst1[j] - lst1[j - 1] or (lst2[j] < m2):
				f = 1
				print('NO')
				break
			else:
				m1 = lst1[j]
				m2 = lst2[j]
		if f == 0:
			print('YES')


for q in range(int(input())):
	res = 'YES'
	n = int(input())
	(p1, c1) = map(int, input().split())
	if c1 > p1:
		res = 'NO'
	for i in range(n - 1):
		(p, c) = map(int, input().split())
		if c > p:
			res = 'NO'
		if p < p1:
			res = 'NO'
		if c < c1:
			res = 'NO'
		if p - p1 < c - c1:
			res = 'NO'
		p1 = p
		c1 = c
	print(res)


for _ in range(int(input())):
	i = int(input())
	a = b = t = 0
	for x in range(i):
		(p, c) = map(int, input().split())
		if p < c or c - b > p - a:
			t = 1
		if p < a or c < b:
			t = 1
		a = p
		b = c
	print('NO' if t == 1 else 'YES')


from math import *
for __ in range(int(input())):
	n = int(input())
	x = 0
	y = 0
	ans = 'YES'
	for i in range(n):
		(a, b) = map(int, input().split())
		if a < x or b < y:
			ans = 'NO'
		elif a - x < b - y:
			ans = 'NO'
		else:
			x = a
			y = b
	print(ans)


t = int(input())
for t1 in range(t):
	n = int(input())
	realData = True
	p = 0
	c = 0
	for n1 in range(n):
		pPr = p
		cPr = c
		(p, c) = map(int, input().split())
		pDif = p - pPr
		cDif = c - cPr
		if cDif > pDif:
			realData = False
		if pDif < 0 or cDif < 0:
			realData = False
	print(('NO', 'YES')[realData])


t = int(input())
for i in range(t):
	n = int(input())
	ar = []
	for j in range(n):
		ar.append([int(k) for k in input().split()])
	flag = 0
	i = 0
	if n == 0:
		print('YES')
		continue
	if ar[0][0] < ar[0][1]:
		print('NO')
		continue
	i = 1
	while i < n:
		if ar[i][0] < ar[i - 1][0] or ar[i][1] < ar[i - 1][1] or ar[i][0] - ar[i - 1][0] < ar[i][1] - ar[i - 1][1]:
			flag = 1
			break
		i += 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	(pa, pb, fg) = (0, 0, 0)
	for i in range(n):
		(a, b) = map(int, input().split())
		if a < pa or b < pb or a < b or (a - pa < b - pb):
			fg = 1
		(pa, pb) = (a, b)
	print('NO') if fg == 1 else print('YES')


from sys import exit as sys_ret
for _ in range(int(input())):
	flag = 1
	amount = int(input())
	(Tplays, Tclears) = map(int, input().split())
	if Tclears > Tplays:
		flag = 0
	amount -= 1
	(plays, clears) = (Tplays, Tclears)
	while amount != 0:
		amount -= 1
		(Tplays, Tclears) = map(int, input().split())
		if Tclears > Tplays or Tplays < plays or Tclears < clears or (Tplays - plays < Tclears - clears):
			flag = 0
		(plays, clears) = (Tplays, Tclears)
	print('YES' if flag == 1 else 'NO')


for uhioio in range(int(input())):
	lp = ln = 0
	able = True
	for i in range(int(input())):
		if able:
			(p, n) = map(int, input().split())
			if n < 0 or p < 0 or ln > n or (n - ln > p - lp) or (lp > p):
				able = False
			else:
				ln = n
				lp = p
		else:
			input()
	print(('No', 'Yes')[able])


t = int(input())
for i in range(t):
	n = int(input())
	matrix = []
	for j in range(n):
		a = list(map(int, input().split()))
		matrix.append(a)
	prevp = matrix[0][0]
	prevc = matrix[0][1]
	flag = 0
	for j in range(n):
		if matrix[j][0] < matrix[j][1]:
			flag = 1
			break
		played = matrix[j][0] - prevp
		cleared = matrix[j][1] - prevc
		if cleared > played:
			flag = 1
			break
		if played < 0 or cleared < 0:
			flag = 1
			break
		prevp = matrix[j][0]
		prevc = matrix[j][1]
	if flag == 0:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

def in_int():
	return int(input())

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

def in_str():
	s = input()
	return list(s[:len(s) - 1])

def in_ints():
	return map(int, input().split())
t = in_int()
while t > 0:
	t -= 1
	n = in_int()
	a = []
	for xx in range(n):
		l = in_list()
		a.append(l)
	player = a[0][0]
	clear = a[0][1]
	if player < clear:
		print('NO')
	else:
		ans = True
		for ll in a[1:]:
			p = ll[0]
			c = ll[1]
			if p >= player and c >= clear and (p >= c) and (p - player >= c - clear):
				player = p
				clear = c
				continue
			ans = False
		if ans:
			print('YES')
		else:
			print('NO')


def solve(n, parr, carr):
	if parr[0] < carr[0]:
		return False
	for i in range(1, n):
		if parr[i - 1] > parr[i]:
			return False
		if carr[i - 1] > carr[i]:
			return False
		if parr[i] - parr[i - 1] < carr[i] - carr[i - 1]:
			return False
	return True
for _ in range(int(input())):
	n = int(input())
	(parr, carr) = (list(), list())
	for i in range(n):
		(p, c) = map(int, input().split())
		parr.append(p)
		carr.append(c)
	print('YES') if solve(n, parr, carr) else print('NO')


for _ in range(int(input())):
	te = []
	n = int(input())
	x = 0
	d = {}
	plays = 0
	clear = 0
	for i in range(n):
		(a, b) = list(map(int, input().split()))
		if clear > b or plays > a or b > a or (a - plays < b - clear):
			x = 1
		else:
			clear = b
			plays = a
			if a in d.keys():
				if b in d[a]:
					d[a].append(b)
				elif b not in d[a]:
					x = 1
			else:
				d[a] = [b]
	if x == 1:
		print('NO')
	if x == 0:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	pp = []
	cc = []
	f = 0
	q = 0
	pp.append(0)
	cc.append(0)
	for j in range(1, n + 1):
		(p, c) = map(int, input().split())
		pp.append(p)
		cc.append(c)
	for j in range(0, n):
		if pp[j] > pp[j + 1] or cc[j] > cc[j + 1]:
			f = 1
			break
	for j in range(1, n + 1):
		if pp[j] - pp[j - 1] < cc[j] - cc[j - 1]:
			q = 1
			break
	if f == 1 or q == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	res = True
	px = 0
	cx = 0
	while n:
		n -= 1
		(p, c) = map(int, input().split())
		if not res:
			continue
		if p < px:
			res = False
			continue
		if c < cx:
			res = False
			continue
		if p - px < c - cx:
			res = False
			continue
		px = p
		cx = c
	print('YNEOS'[not res::2])


for t in range(int(input())):
	n = int(input())
	(P, C) = ([], [])
	for i in range(n):
		(a, b) = map(int, input().split())
		P.append(a)
		C.append(b)
	for i in range(n):
		if P[i] < C[i]:
			break
		if i == n - 1:
			continue
		(dp, dc) = (P[i + 1] - P[i], C[i + 1] - C[i])
		if dp < 0 or dc < 0:
			break
		if dp < dc:
			break
	else:
		print('YES')
		continue
	print('NO')


T = int(input())
flag = True
for i in range(T):
	n = int(input())
	flag = True
	(a_pre, b_pre) = map(int, input().split())
	if a_pre < b_pre:
		flag = False
	for i in range(n - 1):
		(a, b) = map(int, input().split())
		if a - a_pre < b - b_pre or a < a_pre or b < b_pre or (b > a):
			flag = False
		(a_pre, b_pre) = (a, b)
	if flag == False:
		print('NO')
	else:
		print('YES')


t = int(input())
for q in range(t):
	n = int(input())
	f = 1
	cnt = 0
	wns = 0
	for i in range(n):
		(s1, s2) = map(int, input().split())
		if s2 > s1 or cnt - wns > s1 - s2 or s2 < wns:
			f = 0
		(cnt, wns) = (s1, s2)
	print('YES') if f else print('NO')


def solve():
	n = int(input())
	stats = []
	last = None
	good = True
	for i in range(n):
		(p, c) = [int(v) for v in input().split()]
		if c > p:
			good = False
		if i:
			if p < last[0] or c < last[1]:
				good = False
			if c - last[1] > p - last[0]:
				good = False
		last = (p, c)
	if good:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for x in range(t):
	n = int(input())
	listAux = []
	flag = True
	for j in range(n):
		(p, c) = list(map(int, input().split()))
		listAux.append([p, c])
	if listAux[0][0] < listAux[0][1]:
		flag = False
	else:
		for i in range(1, len(listAux)):
			if listAux[i][0] == listAux[i - 1][0] and listAux[i][1] != listAux[i - 1][1] or listAux[i][0] - listAux[i - 1][0] < listAux[i][1] - listAux[i - 1][1] or listAux[i][0] < listAux[i - 1][0] or (listAux[i][1] < listAux[i - 1][1]):
				flag = False
				break
	if flag == False:
		print('NO')
	else:
		print('YES')


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	a = []
	for i in range(n):
		(p, c) = map(int, sys.stdin.readline().split())
		a.append([p, c])
	if a[0][0] < a[0][1]:
		print('NO')
	else:
		flag = True
		for i in range(1, n):
			if a[i][0] < a[i][1] or a[i][1] < a[i - 1][1] or a[i][0] < a[i - 1][0] or (a[i][1] - a[i - 1][1] > a[i][0] - a[i - 1][0]):
				flag = False
				print('NO')
				break
		if flag:
			print('YES')


T = int(input())
for t in range(T):
	N = int(input())
	r = 'YES'
	pc = [[0, 0]]
	for n in range(1, N + 1):
		pc.append(list(map(int, input().split())))
	for n in range(1, N + 1):
		if pc[n][0] < pc[n - 1][0]:
			r = 'NO'
			break
		if pc[n][0] < pc[n - 1][0] or pc[n][1] < pc[n - 1][1]:
			r = 'NO'
			break
		if pc[n][1] - pc[n - 1][1] > pc[n][0] - pc[n - 1][0]:
			r = 'NO'
			break
	print(r)


for _ in range(int(input())):
	n = int(input())
	(p, c) = [int(i) for i in input().split()]
	ans = 'NO' if p < c else 'YES'
	for j in range(1, n):
		(p1, c1) = [int(i) for i in input().split()]
		if (p1 < p or c1 < c) or c1 - c > p1 - p or p1 < c1:
			ans = 'NO'
		(p, c) = (p1, c1)
	print(ans)


l = [0, 0]
for i in range(int(input())):
	a = int(input())
	f = 0
	for i in range(a):
		(m, n) = map(int, input().split())
		if n > m or l[0] > m or l[1] > n or (m - l[0] < n - l[1]):
			f = 1
		(l[0], l[1]) = (m, n)
	print(['NO', 'YES'][f == 0])
	(l[0], l[1]) = (0, 0)


for _ in range(int(input())):
	n = int(input())
	(minplay, minclear) = (0, 0)
	(plays, clears) = (0, 0)
	ans = 'YES'
	for i in range(n):
		(p, c) = map(int, input().split())
		if minplay > p or minclear > c or p < c or (p - plays < c - clears):
			ans = 'NO'
		minplay = max(minplay, p)
		minclear = max(minclear, c)
		plays = p
		clears = c
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = []
	for i in range(n):
		a = list(map(int, input().split()))
		arr.append(a.copy())
	ch = 1
	for i in range(n):
		if arr[i][0] < arr[i][1]:
			print('NO')
			ch = 0
			break
		if i > 0:
			if arr[i][0] < arr[i - 1][0] or arr[i][1] < arr[i - 1][1]:
				print('NO')
				ch = 0
				break
			elif arr[i][1] - arr[i - 1][1] > arr[i][0] - arr[i - 1][0]:
				print('NO')
				ch = 0
				break
	if ch == 1:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	p = []
	c = []
	good = True
	for i in range(n):
		data = [int(s) for s in input().split()]
		p.append(data[0])
		c.append(data[1])
	for i in range(n):
		if c[i] > p[i]:
			print('NO')
			good = False
			break
		if i > 0 and (p[i] < p[i - 1] or c[i] < c[i - 1] or p[i] - p[i - 1] < c[i] - c[i - 1]):
			print('NO')
			good = False
			break
	if good:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	p = 0
	c = 0
	flag = True
	for i in range(n):
		(pi, ci) = [int(x) for x in input().strip().split()]
		if pi < p:
			flag = False
		elif ci < c:
			flag = False
		elif ci - c > pi - p:
			flag = False
		else:
			p = pi
			c = ci
	if flag:
		print('YES')
	else:
		print('NO')


n_cases = int(input())
output = []
for i in range(0, n_cases):
	n_peeks = int(input())
	pairs = []
	for i in range(0, n_peeks):
		pairs.append(list(map(int, input().split())))
	poss = 'YES'
	for i in range(1, len(pairs)):
		if pairs[i][0] < pairs[i - 1][0] or pairs[i][1] - pairs[i - 1][1] > pairs[i][0] - pairs[i - 1][0] or pairs[i][1] < pairs[i - 1][1] or (pairs[i][0] < pairs[i][1]):
			poss = 'NO'
			break
	if len(pairs) > 0 and pairs[0][0] < pairs[0][1]:
		poss = 'NO'
	output.append(poss)
for i in range(0, len(output)):
	print(output[i])


t = int(input())
for i in range(t):
	n = int(input())
	(antX, antY) = map(int, input().split())
	ans = True
	if antY > antX:
		ans = False
	for j in range(n - 1):
		(x, y) = map(int, input().split())
		if y > x:
			ans = False
		elif x < antX or y < antY:
			ans = False
		elif abs(y - antY) > abs(antX - x):
			ans = False
		antY = y
		antX = x
	print('YES' if ans else 'NO')


t = int(input())
for _ in range(t):
	pp = 0
	cp = 0
	n = int(input())
	ok = True
	for __ in range(n):
		(p, c) = [int(x) for x in input().split()]
		if p < pp or c < cp or p - pp < c - cp:
			ok = False
		pp = p
		cp = c
	if ok:
		print('YES')
	else:
		print('NO')


test = int(input())
for t in range(test):
	level = int(input())
	origin = [0, 0]
	check = 1
	for l in range(level):
		next = [int(i) for i in input().split()]
		diff0 = next[0] - origin[0]
		diff1 = next[1] - origin[1]
		diff01 = next[0] - next[1]
		if check == 1 and diff0 < 0 or diff1 < 0 or diff01 < 0:
			check = 0
		elif check == 1 and diff0 < diff1:
			check = 0
		else:
			origin = next
		if l == level - 1:
			if check == 1:
				print('Yes')
			else:
				print('NO')


import math
import fractions

def make_divisors(n):
	divisors = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n // i)
	return divisors

def ValueToBits(x, digit):
	res = [0 for i in range(digit)]
	now = x
	for i in range(digit):
		res[i] = now % 2
		now = now >> 1
	return res

def BitsToValue(arr):
	n = len(arr)
	ans = 0
	for i in range(n):
		ans += arr[i] * 2 ** i
	return ans

def ValueToArray10(x, digit):
	ans = [0 for i in range(digit)]
	now = x
	for i in range(digit):
		ans[digit - i - 1] = now % 10
		now = now // 10
	return ans
t = int(input())
for k in range(t):
	n = int(input())
	prev = list(map(int, input().split()))
	ans = 'YES'
	if prev[0] < prev[1]:
		ans = 'NO'
	for i in range(n - 1):
		put = list(map(int, input().split()))
		if not (prev[0] <= put[0] and prev[1] <= put[1] and (put[1] <= put[0])):
			ans = 'NO'
		if put[0] - prev[0] < put[1] - prev[1]:
			ans = 'NO'
		prev = list(put)
	print(ans)


for _ in range(int(input())):
	x = y = z = -1
	t = 0
	n = int(input())
	for i in range(n):
		(a, b) = map(int, input().split())
		if a < x or b < y or b > a or (a - b < z):
			t = 1
		x = a
		y = b
		z = a - b
	else:
		if t == 0:
			print('YES')
		else:
			print('NO')


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		p = 0
		c = 0
		ans = 'YES'
		for __ in range(n):
			(p_, c_) = map(int, input().split())
			if p_ < p or c_ < c or p_ - p < c_ - c:
				ans = 'NO'
			else:
				p = p_
				c = c_
		print(ans)
main()


from sys import stdin
T = int(input())
for _ in range(T):
	N = int(input())
	pc = []
	for _ in range(N):
		(p, c) = stdin.readline().split()
		pc.append((int(p), int(c)))
	if len(pc) == 1:
		if pc[0][0] >= pc[0][1]:
			print('YES')
		else:
			print('NO')
	else:
		if pc[0][0] < pc[0][1]:
			print('NO')
			continue
		for i in range(1, len(pc)):
			if pc[i][0] < pc[i - 1][0] or pc[i][1] < pc[i - 1][1]:
				print('NO')
				i = -1
				break
			if pc[i][0] < pc[i][1]:
				print('NO')
				i = -1
				break
			if pc[i][0] - pc[i - 1][0] < pc[i][1] - pc[i - 1][1]:
				print('NO')
				i = -1
				break
		if i == len(pc) - 1:
			print('YES')


def funct(c, p):
	for i in range(len(c) - 1):
		if c[i] > c[i + 1]:
			return 'NO'
	for i in range(len(p) - 1):
		if p[i] > p[i + 1]:
			return 'NO'
	for i in range(len(c)):
		if c[i] > p[i]:
			return 'NO'
	for i in range(1, len(c)):
		if p[i] - p[i - 1] < c[i] - c[i - 1]:
			return 'NO'
	return 'YES'
n = int(input())
for i in range(n):
	m = int(input())
	c = []
	p = []
	for j in range(m):
		s = input().split()
		c.append(int(s[1]))
		p.append(int(s[0]))
	print(funct(c, p))


T = int(input())
for t in range(T):
	n = int(input())
	(p, c) = (0, 0)
	dif = 0
	flag = 0
	for i in range(n):
		(pn, cn) = map(int, input().split())
		if pn - cn < dif:
			flag = 1
		if pn < p:
			flag = 1
		if cn < c:
			flag = 1
		dif = pn - cn
		p = pn
		c = cn
	if flag == 1:
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	N = int(input())
	(p, c) = (0, 0)
	ok = 1
	for _ in range(N):
		(x, y) = map(int, input().split())
		if p > x or c > y:
			ok = 0
		if y - c > x - p:
			ok = 0
		p = x
		c = y
	if ok:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	attempts = []
	clears = []
	for i in range(n):
		(p, c) = map(int, input().split())
		attempts.append(p)
		clears.append(c)
	c = 0
	for i in range(1, n):
		if attempts[i] >= attempts[i - 1] and clears[i] >= clears[i - 1] and (attempts[i] >= clears[i]) and (attempts[i] - attempts[i - 1] >= clears[i] - clears[i - 1]):
			continue
		else:
			c = 1
			break
	if attempts[0] < clears[0]:
		c = 1
	if c == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
e = []
for i in range(t):
	n = int(input())
	p0 = 0
	c0 = 0
	d = 'YES'
	for j in range(n):
		(p1, c1) = input().split(' ')
		p1 = int(p1)
		c1 = int(c1)
		if d == 'YES':
			if p1 >= c1 and p1 >= p0 and (c1 >= c0) and (p1 - p0 >= c1 - c0):
				pass
			else:
				d = 'NO'
		p0 = p1
		c0 = c1
	e.append(d)
for i in e:
	print(i)


for _ in range(int(input())):
	n = int(input())
	data = []
	for q in range(n):
		data.append([int(x) for x in input().split()])
	flag = 0
	(prevattempt, prevclear) = (0, 0)
	for q in range(n):
		p = data[q][0]
		c = data[q][1]
		if c > p:
			flag = 1
			break
		if p < prevattempt:
			flag = 1
			break
		if c < prevclear:
			flag = 1
			break
		if p - prevattempt < c - prevclear:
			flag = 1
			break
		(prevattempt, prevclear) = (p, c)
	if flag:
		print('NO')
	else:
		print('YES')


t = int(input())

def solve(n, prs):
	(pp, pc) = (0, 0)
	for i in range(n):
		(p, c) = prs[i]
		if c > p:
			return False
		if c < pc or p < pp:
			return False
		if c - pc > p - pp:
			return False
		(pp, pc) = (p, c)
	return True
for _ in range(t):
	n = int(input())
	prs = []
	for _ in range(n):
		(a, b) = map(int, input().split())
		prs.append((a, b))
	print('YES' if solve(n, prs) else 'NO')


def check(logs):
	p = 0
	c = 0
	for log in logs:
		if log[0] < p or log[1] < c or log[0] < log[1] or (log[1] - c > log[0] - p):
			return 'NO'
		c = log[1]
		p = log[0]
	return 'YES'
tests = int(input())
for t in range(tests):
	logs = []
	n = int(input())
	for log in range(n):
		logs.append(list(map(int, input().split())))
	print(check(logs))


for _ in range(int(input())):
	n = int(input())
	(a, b) = (0, 0)
	ans = 'YES'
	for i in range(n):
		(x, y) = map(int, input().split())
		if 0 > min(x - a, y - b, x - a - y + b):
			ans = 'NO'
		(a, b) = (x, y)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	for i in range(n):
		(x, y) = map(int, input().strip().split())
		arr.append((x, y))
	if arr[0][0] >= arr[0][1]:
		flag = True
		(p, q) = (arr[0][0], arr[0][1])
		for pair in arr[1:]:
			if pair[0] < pair[1] or pair[0] < p or pair[1] < q or (abs(p - q) > abs(pair[0] - pair[1])):
				flag = False
				break
			else:
				p = pair[0]
				q = pair[1]
		if flag:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def bool_to_str(flag):
	if flag:
		return 'YES'
	else:
		return 'NO'
test_cases = inp()
for test in range(test_cases):
	peaks = inp()
	last_plays = 0
	last_clears = 0
	valid = True
	for peak in range(peaks):
		current_pair = inlt()
		if current_pair[0] < last_plays:
			valid = False
		if current_pair[1] < last_clears:
			valid = False
		if current_pair[1] - last_clears > current_pair[0] - last_plays:
			valid = False
		if current_pair[1] > current_pair[0]:
			valid = False
		last_plays = current_pair[0]
		last_clears = current_pair[1]
	print(bool_to_str(valid))


for i in range(int(input())):
	g = 0
	a = 0
	b = 0
	for j in range(int(input())):
		(f, n) = map(int, input().split())
		if f - a < n - b:
			g = g + 1
		elif f < a:
			g = g + 1
		elif n < b:
			g = g + 1
		a = f
		b = n
	if g == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	flag = 0
	for j in range(n):
		x = input().split()
		x[0] = int(x[0])
		x[1] = int(x[1])
		l.append(x)
		if x[1] > x[0] or (j != 0 and (l[j][0] < l[j - 1][0] or l[j][1] < l[j - 1][1] or l[j][0] - l[j - 1][0] < l[j][1] - l[j - 1][1])):
			flag = 1
	if flag == 1:
		print('NO')
		continue
	print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	p_c_prev = [0, 0]
	yes = True
	for j in range(n):
		p_cS = input().split(' ')
		p_c = [int(i) for i in p_cS]
		d0 = p_c[0] - p_c_prev[0]
		d1 = p_c[1] - p_c_prev[1]
		if d0 < d1 or d0 < 0 or d1 < 0:
			yes = False
		p_c_prev = p_c
	if yes:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	data = []
	for i in range(n):
		(p, c) = map(int, input().split())
		data.append((p, c))
	check = True
	if data[0][0] < data[0][1]:
		check = False
	else:
		for i in range(n - 1):
			if data[i][0] == data[i + 1][0] and data[i][1] == data[i + 1][1]:
				continue
			if data[i][0] < data[i + 1][0] and (data[i][1] <= data[i + 1][1] and data[i + 1][1] <= data[i][1] + (data[i + 1][0] - data[i][0])):
				continue
			check = False
			break
	if check:
		print('YES')
	else:
		print('NO')


t = int(input())
for tc in range(t):
	n = int(input())
	num = [[0, 0]]
	f1 = 0
	for i in range(n):
		s = input().split()
		(p, c) = (int(s[0]), int(s[1]))
		if c > p:
			f1 = 1
		else:
			pp = num[i][0]
			pc = num[i][1]
			if p >= pp + (c - pc) and c >= pc:
				pass
			else:
				f1 = 1
		num.append([p, c])
	if f1 == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin

def main():
	t = int(input())
	for __ in range(t):
		n = int(input())
		flag = True
		A = 0
		B = 0
		for i in range(n):
			(a, b) = map(int, input().split())
			if (a < A or b < B) or a - A < b - B:
				flag = False
			A = a
			B = b
		if flag:
			print('YES')
		else:
			print('NO')
main()


for _ in range(int(input())):
	(p, c, k) = (0, 0, 1)
	for i in range(int(input())):
		(x, y) = map(int, input().split())
		if k:
			if x - p < 0 or y - c < 0 or y - c > x - p:
				k = 0
			else:
				(p, c) = (x, y)
	print('YES' if k else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	p = []
	c = []
	for j in range(n):
		(p1, c1) = map(int, input().split())
		p.append(p1)
		c.append(c1)
	if p[0] >= c[0]:
		e = 1
		for k in range(1, n):
			if p[k] < p[k - 1] or c[k] < c[k - 1]:
				e = 0
				print('NO')
				break
			elif c[k] - c[k - 1] > p[k] - p[k - 1]:
				e = 0
				print('NO')
				break
		if e == 1:
			print('YES')
	else:
		print('NO')


T = int(input())

def solve():
	N = int(input())
	PC = []
	for _ in range(N):
		[p, c] = list(map(int, input().split()))
		PC.append([p, c])
	for i in range(N):
		if i == 0:
			if PC[i][1] > PC[i][0]:
				return 'NO'
			continue
		delta_p = PC[i][0] - PC[i - 1][0]
		delta_c = PC[i][1] - PC[i - 1][1]
		if PC[i][1] > PC[i][0]:
			return 'NO'
		if delta_p < 0 or delta_c < 0:
			return 'NO'
		if delta_c > delta_p:
			return 'NO'
	return 'YES'
for _ in range(T):
	print(solve())


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		n = int(input())
		pl = 0
		cl = 0
		res = 'YES'
		for _ in range(n):
			(p, c) = map(int, input().split())
			if p < pl or c < cl or c - cl > p - pl:
				res = 'NO'
			pl = p
			cl = c
		print(res)
	q = int(input())
	for _ in range(q):
		solve()
main()


for _ in range(int(input())):
	n = int(input())
	arr = [0] * n
	for i in range(n):
		(a, b) = [int(s) for s in input().split()]
		arr[i] = (a, b)
	flag = True
	if arr[0][1] > arr[0][0]:
		flag = False
	for i in range(1, len(arr)):
		if arr[i][1] > arr[i][0]:
			flag = False
			break
		if arr[i][1] < arr[i - 1][1] or arr[i][0] < arr[i - 1][0]:
			flag = False
		if arr[i][0] == arr[i - 1][0] and arr[i][1] != arr[i - 1][1]:
			flag = False
		if arr[i][0] - arr[i - 1][0] < arr[i][1] - arr[i - 1][1]:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	k = []
	for __ in range(n):
		k.append(list(map(int, input().split())))
	flag = 1
	for i in range(n):
		if i == 0 and k[i][0] >= k[i][1]:
			pass
		elif k[i - 1][0] <= k[i][0] and k[i - 1][1] <= k[i][1] and (k[i][0] >= k[i][1]):
			if k[i][1] - k[i - 1][1] <= k[i][0] - k[i - 1][0]:
				pass
			else:
				flag = 0
				break
		else:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


for lo in range(int(input())):
	n = int(input())
	(p, c) = (0, 0)
	ans = 'YES'
	for i in range(n):
		(u, v) = map(int, input().split())
		if u - p < 0 or v - c < 0:
			ans = 'NO'
		if u - p < v - c:
			ans = 'NO'
		(p, c) = (u, v)
	print(ans)


t = int(input())
cases = []
for _ in range(t):
	n = int(input())
	p_prev = 0
	c_prev = 0
	a = []
	for _ in range(n):
		(p, c) = [int(i) for i in input().split()]
		a.append((p, c))
	ok = True
	for (p, c) in a:
		if p < p_prev:
			ok = False
			break
		if c < c_prev:
			ok = False
			break
		p_diff = p - p_prev
		c_diff = c - c_prev
		if p_diff < c_diff:
			ok = False
			break
		if c_diff < 0:
			ok = False
			break
		p_prev = p
		c_prev = c
	if ok:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	lis = []
	for i in range(n):
		(a, b) = map(int, input().split())
		lis.append([a, b])
		c = 1
	if lis[0][0] >= lis[0][1]:
		for i in range(1, n):
			a = lis[i][0] - lis[i - 1][0]
			b = lis[i][1] - lis[i - 1][1]
			if lis[i][0] >= lis[i][1] and lis[i - 1][0] <= lis[i][0] and (lis[i - 1][1] <= lis[i][1]) and (a >= b):
				continue
			else:
				c = 0
				break
	else:
		c = 0
	if c:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	work = True
	tests = [tuple(map(int, input().split())) for _ in range(int(input()))]
	if not tests[0][0] < tests[0][1]:
		for x in range(1, len(tests)):
			if tests[x][0] < tests[x][1] or tests[x - 1][0] > tests[x][0] or tests[x - 1][1] > tests[x][1] or (tests[x][0] - tests[x - 1][0] < tests[x][1] - tests[x - 1][1]):
				work = False
				break
	else:
		work = False
	print('YES' if work else 'NO')


for t in range(int(input())):
	n = int(input())
	attempts = []
	clears = []
	x = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < c:
			x += 1
		attempts.append(p)
		clears.append(c)
	for i in range(n - 1):
		if attempts[i] > attempts[i + 1] or clears[i] > clears[i + 1] or clears[i + 1] - clears[i] > attempts[i + 1] - attempts[i]:
			x += 1
	if x == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	(last_p, last_c) = (0, 0)
	ans = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < last_p or c < last_c or p - last_p < c - last_c:
			ans = False
		last_p = p
		last_c = c
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	curr_p = 0
	curr_c = 0
	f = 0
	for __ in range(n):
		(p, c) = map(int, input().split())
		if c > p:
			f = 1
			continue
		if p < curr_p or c < curr_c:
			f = 1
			continue
		if p - curr_p < c - curr_c:
			f = 1
			continue
		curr_c = c
		curr_p = p
	if f == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	T = True
	max_p = 0
	max_c = 0
	for game in range(n):
		(p, c) = map(int, input().split())
		if T:
			if p < c:
				T = False
			elif max_p > p or max_c > c:
				T = False
			elif p - max_p < c - max_c:
				T = False
		max_p = p
		max_c = c
	if T:
		print('YES')
	else:
		print('NO')


t = int(input())
for z in range(t):
	n = int(input())
	(p_prev, c_prev) = (0, 0)
	ans = 'YES'
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < p_prev:
			ans = 'NO'
		elif c < c_prev:
			ans = 'NO'
		elif p < p_prev + c - c_prev:
			ans = 'NO'
		(p_prev, c_prev) = (p, c)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	ans = ['YES', 'NO']
	num = 0
	numc = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if p - c < num or numc > c:
			ans[0] = ans[1]
		num = p - c
		numc = c
	print(ans[0])


def solve():
	nr = int(input())
	prv_play = 0
	prv_clear = 0
	s = True
	x = []
	for _ in range(nr):
		(p, c) = [int(x) for x in input().split(' ')]
		x.append((p, c))
	for a in x:
		p = a[0]
		c = a[1]
		if c > p:
			s = False
			break
		if c < prv_clear:
			s = False
			break
		else:
			delta = c - prv_clear
			if p < prv_play + delta:
				s = False
				break
		prv_play = p
		prv_clear = c
	if s:
		print('YES')
	else:
		print('NO')

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


t = int(input())
for i in range(t):
	k = int(input())
	a = 0
	b = 0
	flag = 0
	for j in range(k):
		(n, c) = [int(x) for x in input().split()]
		if n - a >= c - b and n - a >= 0 and (c - b >= 0):
			a = n
			b = c
		else:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	cur1 = 0
	cur2 = 0
	y = 0
	tg = 1
	for x in range(n):
		(a, b) = map(int, input().split(' '))
		if a >= cur1:
			cur1 = a
		else:
			tg = 0
		if b >= cur2:
			cur2 = b
		else:
			tg = 0
		c = a - b
		if c >= y:
			y = c
		else:
			tg = 0
	if tg:
		print('YES')
	else:
		print('NO')


def main():
	n = int(input())
	(p, c) = ([0], [0])
	for i in range(n):
		(_p, _c) = map(int, input().split())
		p.append(_p)
		c.append(_c)
	for i in range(n):
		dif_p = p[i + 1] - p[i]
		dif_c = c[i + 1] - c[i]
		if dif_p < 0 or dif_c < 0 or dif_p < dif_c:
			return 'No'
	return 'Yes'
t = int(input())
for i in range(t):
	print(main())


from sys import stdin, stdout
input = stdin.readline
print = stdout.write
R = lambda : list(map(int, input().split()))
T = int(input())
for _ in range(T):
	n = int(input())
	(a, b, ok) = (0, 0, 1)
	for _ in range(n):
		(na, nb) = R()
		if na < nb or na < a or nb < b or (na - a < nb - b):
			ok = 0
		(a, b) = (na, nb)
	print('YES\n' if ok else 'NO\n')


t = int(input())
for _ in range(t):
	l = int(input())
	arr = []
	for _ in range(l):
		arr.append([int(x) for x in input().split()])
	r = 'YES'
	if arr[0][0] < arr[0][1]:
		r = 'NO'
	else:
		for i in range(0, l - 1):
			if (arr[i + 1][0] - arr[i][0] < 0 or arr[i + 1][1] - arr[i][1] < 0) or arr[i + 1][1] - arr[i][1] > arr[i + 1][0] - arr[i][0] or arr[i][1] > arr[i][0]:
				r = 'NO'
				break
	print(r)


t = int(input())
for _ in range(t):
	n = int(input())
	(p, c) = ([], [])
	prev_p = prev_c = 0
	ans = 'YES'
	for __ in range(n):
		(a, b) = map(int, input().split())
		if a < prev_p or b < prev_c or a < b:
			ans = 'NO'
		(prev_p, prev_c) = (a, b)
		p.append(a)
		c.append(b)
	for i in range(1, n):
		if p[i] - p[i - 1] < c[i] - c[i - 1]:
			ans = 'NO'
	print(ans)


def main():
	n = int(input())
	(pre_p, pre_c) = (0, 0)
	no = False
	for _ in range(n):
		(cur_p, cur_c) = map(int, input().split())
		if cur_p - pre_p < cur_c - pre_c or pre_p > cur_p or pre_c > cur_c:
			no = True
		(pre_p, pre_c) = (cur_p, cur_c)
	print('NO' if no else 'YES')
for _ in range(int(input())):
	main()


cases = int(input())
for _ in range(cases):
	size = int(input())
	lst = []
	for __ in range(size):
		arr = tuple(map(int, input().split()))
		lst.append(arr)
	if lst[0][0] < lst[0][1]:
		print('NO')
	else:
		flag = True
		for i in range(1, size):
			clear_diff = lst[i][1] - lst[i - 1][1]
			if lst[i][0] - lst[i - 1][0] < 0 or clear_diff < 0:
				print('NO')
				flag = False
				break
			elif lst[i][0] - lst[i - 1][0] < clear_diff:
				print('NO')
				flag = False
				break
			else:
				continue
		if flag:
			print('YES')


import sys
input = lambda : sys.stdin.readline().rstrip()

def I():
	return list(map(int, input().split()))
for _ in range(I()[0]):
	n = I()[0]
	(a, b) = (0, 0)
	flag = 0
	for i in range(n):
		(x, y) = I()
		if x >= a and y >= b and (x - a >= y - b):
			a = x
			b = y
			continue
		else:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	pre_p = -1
	pre_c = -1
	flag = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < pre_p or c < pre_c or p < c or (p - pre_p < c - pre_c):
			flag = 1
		pre_p = p
		pre_c = c
	if flag:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
t = int(stdin.readline())
for test in range(t):
	n = int(stdin.readline())
	arr = [int(x) for x in stdin.readline().split()]
	ans = 'YES'
	play = arr[0]
	clear = arr[1]
	if clear > play:
		ans = 'NO'
	for i in range(n - 1):
		arr = [int(x) for x in stdin.readline().split()]
		play2 = arr[0]
		clear2 = arr[1]
		if clear2 > play2 or play2 < play or clear2 < clear or (play2 - play < clear2 - clear):
			ans = 'NO'
		play = play2
		clear = clear2
	stdout.write(ans + '\n')


t = int(input())
for y in range(t):
	n = int(input())
	a = []
	f = 1
	for i in range(n):
		a.append(list(map(int, input().split())))
		if a[-1][0] < a[-1][1]:
			f = 0
	for i in range(n - 1):
		if a[i][1] > a[i + 1][1] or a[i][0] > a[i + 1][0]:
			f = 0
			break
		if a[i + 1][0] - a[i + 1][1] + a[i][1] - a[i][0] < 0:
			f = 0
			break
	if f == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	z = int(input())
	x = y = c = 0
	for j in range(z):
		(a, b) = input().split()
		a = int(a)
		b = int(b)
		if a < x or b < y or b - y > a - x:
			c = c + 1
		x = a
		y = b
	if c > 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	li = [list(map(int, input().split())) for i in range(n)]
	if n != 0:
		(check1, check2) = (0, 0)
		flag = 0
		for i in range(0, n):
			if check1 - li[i][0] > check2 - li[i][1]:
				flag = 1
				print('NO')
				break
			elif check1 > li[i][0] or check2 > li[i][1]:
				flag = 1
				print('NO')
				break
			else:
				check1 = li[i][0]
				check2 = li[i][1]
		if flag == 0:
			print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	ip = [[0, 0]]
	for j in range(n):
		ip.append(list(map(int, input().split())))
	(prevplay, prevclear) = ip[0]
	ok = True
	for j in range(1, len(ip)):
		(currplay, currclear) = ip[j]
		if currplay < currclear or currplay < prevplay or currclear < prevclear or (currplay - currclear < prevplay - prevclear):
			ok = False
			break
		(prevplay, prevclear) = (currplay, currclear)
	if ok:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = 0
	c = 0
	flag = 1
	for j in range(n):
		(x, y) = map(int, input().split())
		del_a = x - a
		del_c = y - c
		a = x
		c = y
		if del_a < del_c:
			flag = 0
		elif del_a < 0 or del_c < 0:
			flag = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	p1 = []
	c1 = []
	n = int(input())
	if n == 1:
		(p, c) = map(int, input().split())
		if c > p:
			print('NO')
		else:
			print('YES')
		continue
	for i in range(n):
		(p, c) = map(int, input().split())
		p1.append(p)
		c1.append(c)
	flag = 0
	for i in range(n - 1):
		if c1[i] > p1[i]:
			flag = 1
			break
		d = p1[i + 1] - p1[i]
		e = c1[i + 1] - c1[i]
		if d < 0 or e < 0:
			flag = 1
			break
		elif d == 0 and e != 0:
			flag = 1
			break
		elif e > d:
			flag = 1
			break
		else:
			continue
	if flag == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	N = int(input())
	(p, c) = map(int, input().split())
	res = 'YES'
	if p < c:
		res = 'NO'
	if N == 1:
		pass
	else:
		for i in range(1, N):
			(P, C) = map(int, input().split())
			if P >= p:
				if C - c > P - p or C - c < 0:
					res = 'NO'
			else:
				res = 'NO'
			(p, c) = (P, C)
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	pc = [tuple(map(int, input().split())) for i in range(n)]
	p = 0
	c = 0
	flag = True
	for i in range(n):
		if pc[i][0] - p >= pc[i][1] - c and pc[i][0] >= p and (pc[i][1] >= c):
			p = pc[i][0]
			c = pc[i][1]
		else:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	L = []
	n = int(input())
	for i in range(n):
		L.append([int(X) for X in input().split()])
	flag = 0
	for i in range(n):
		if i == 0:
			if L[i][0] < L[i][1]:
				flag = 1
				break
		elif not (L[i][0] >= L[i - 1][0] and L[i][1] >= L[i - 1][1] and (L[i][0] - L[i - 1][0] >= L[i][1] - L[i - 1][1])):
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


import math
import sys
import collections
from collections import defaultdict
sys.setrecursionlimit(10 ** 9)
for _ in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	flag = 0
	for i in range(n):
		(x, y) = map(int, input().split())
		if x >= a and y >= b and (x - a >= y - b):
			a = x
			b = y
			continue
		else:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


I = lambda : int(input())
M = lambda : map(int, input().split())
L = lambda : list(M())
for _ in range(I()):
	n = I()
	al = []
	bl = []
	f1 = True
	f3 = True
	for i in range(n):
		(a, b) = M()
		if b > a:
			f1 = False
		if i != 0:
			if a - al[-1] < b - bl[-1]:
				f3 = False
		al.append(a)
		bl.append(b)
	f2 = False
	if al == sorted(al) and bl == sorted(bl):
		f2 = True
	if f1 and f2 and f3:
		print('YES')
	else:
		print('NO')


def solve(n, plays):
	(prevC, prevP) = (0, 0)
	for i in range(n):
		(currP, currC) = (plays[i][0], plays[i][1])
		if currP < currC:
			print('NO')
			return
		if currP < prevP:
			print('NO')
			return
		if currC < prevC:
			print('NO')
			return
		if currC - prevC > currP - prevP:
			print('NO')
			return
		prevP = currP
		prevC = currC
	print('YES')
t = int(input())
for test in range(t):
	n = int(input())
	plays = []
	for i in range(n):
		(p, c) = map(int, input().split())
		plays.append([p, c])
	solve(n, plays)


t = int(input())
for i in range(t):
	n = int(input())
	nums = [list(map(int, input().split())) for i in range(n)]
	(a, b) = (0, 0)
	flag = True
	for (na, nb) in nums:
		(da, db) = (na - a, nb - b)
		if da < 0 or db < 0 or da < db:
			flag = False
		(a, b) = (na, nb)
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input(''))
for _ in range(t):
	n = int(input(''))
	res = True
	p = []
	c = []
	for i in range(n):
		(pp, cc) = list(map(int, input('').split(' ')))
		p.append(pp)
		c.append(cc)
	if p[0] < c[0]:
		print('NO')
		continue
	for i in range(1, n, 1):
		if p[i - 1] > p[i] or c[i - 1] > c[i] or c[i] > p[i]:
			res = False
			break
		if p[i] - p[i - 1] < c[i] - c[i - 1]:
			res = False
			break
	if res:
		print('YES')
		continue
	print('NO')


for _ in range(int(input())):
	n = int(input())
	(lp, lc) = map(int, input().split())
	ok = lp >= lc
	for _ in range(n - 1):
		(p, c) = map(int, input().split())
		dp = p - lp
		dc = c - lc
		if dp < 0 or dc < 0 or dc > dp:
			ok = False
		(lp, lc) = (p, c)
	print('YES' if ok else 'NO')


def solve(pc):
	pp = cp = 0
	for (p, c) in pc:
		if p < pp or c < cp or c > p or (c - cp > p - pp):
			return False
		pp = p
		cp = c
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	pc = [tuple(map(int, input().split())) for _ in range(n)]
	print('YES' if solve(pc) else 'NO')


for q in range(int(input())):
	n = int(input())
	d = [[0, 0]] + [[int(j) for j in input().split()] for i in range(n)]
	good = True
	for i in range(n):
		dp = d[i + 1][0] - d[i][0]
		dc = d[i + 1][1] - d[i][1]
		if dp < 0 or dc < 0 or dc > dp:
			good = False
			break
	print(['NO', 'YES'][good])


T = int(input())
for tt in range(T):
	n = int(input())
	flag = False
	oldp = -1
	oldc = -1
	for i in range(n):
		[p, c] = [int(i) for i in input().split()]
		if p < c:
			flag = True
		if p < oldp:
			flag = True
		if c < oldc:
			flag = True
		if p - oldp < c - oldc:
			flag = True
		oldc = c
		oldp = p
	if flag:
		print('NO')
	else:
		print('YES')


t = int(input())
for l in range(0, t):
	n = int(input())
	f = True
	(lp, lc) = (0, 0)
	for i in range(0, n):
		(p, c) = map(int, input().split())
		if c - lc > p - lp or lp > p or lc > c:
			f = False
		lp = p
		lc = c
	if f:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(after_p, after_c) = (0, 0)
	(p, c) = (0, 0)
	b = 1
	for i in range(int(input())):
		(p, c) = map(int, input().split())
		if p < after_p or c < after_c or p < c or (p - c < after_p - after_c):
			b = 0
		(after_p, after_c) = (p, c)
	if b:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	(p, w) = map(int, input().split())
	isValid = True
	if w > p:
		isValid = False
	for i in range(n - 1):
		(p1, w1) = map(int, input().split())
		if p1 < p:
			isValid = False
		elif w1 > p1:
			isValid = False
		elif w1 < w:
			isValid = False
		elif w1 - w > p1 - p:
			isValid = False
		p = p1
		w = w1
	if not isValid:
		print('NO')
	else:
		print('YES')


def check():
	n = int(input())
	X = [[0, 0]] + [[int(a) for a in input().split()] for _ in range(n)]
	for i in range(n):
		if X[i + 1][0] >= X[i][0] and X[i + 1][1] >= X[i][1] and (X[i + 1][0] - X[i][0] >= X[i + 1][1] - X[i][1]):
			pass
		else:
			print('NO')
			break
	else:
		print('YES')
T = int(input())
for _ in range(T):
	check()


T = int(input())
for _ in range(T):
	n = int(input())
	pairs = []
	pairsPossible = True
	for i in range(n):
		p = [int(j) for j in input().split()]
		pairs.append(tuple(p))
	if pairs[0][0] - pairs[0][1] >= 0:
		for i in range(1, len(pairs)):
			if pairs[i][0] - pairs[i - 1][0] < 0 or pairs[i][1] - pairs[i - 1][1] < 0 or pairs[i][0] - pairs[i][1] < 0:
				pairsPossible = False
				break
			if pairs[i][0] - pairs[i - 1][0] < pairs[i][1] - pairs[i - 1][1]:
				pairsPossible = False
				break
	else:
		pairsPossible = False
	if pairsPossible:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	l = []
	n = int(input())
	for i in range(n):
		(p, c) = list(map(int, input().split()))
		l.append((p, c))
	for i in range(n):
		if i != 0:
			if l[i][0] < l[i - 1][0] or l[i][1] < l[i - 1][1]:
				print('NO')
				break
			if l[i][0] - l[i - 1][0] < l[i][1] - l[i - 1][1]:
				print('NO')
				break
		if l[i][0] < l[i][1]:
			print('NO')
			break
	else:
		print('YES')


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline().strip())
for _ in range(get_int()):
	n = get_int()
	matrix = []
	for i in range(n):
		matrix.append(get_int_list())
	a = matrix[0][0]
	b = matrix[0][1]
	flag = True
	for i in range(n):
		if matrix[i][0] < a or matrix[i][1] < b:
			flag = False
			break
		if matrix[i][0] - a < matrix[i][1] - b:
			flag = False
			break
		if matrix[i][0] < matrix[i][1]:
			flag = False
			break
		a = matrix[i][0]
		b = matrix[i][1]
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	pa = 0
	pb = 0
	ck = 0
	for i in range(n):
		[a, b] = [int(i) for i in input().split()]
		if a < pa or b < pb or b > a or (b - pb > a - pa):
			ck = 1
		else:
			pa = a
			pb = b
	if ck == 1:
		print('NO')
	else:
		print('YES')


for k in range(int(input())):
	n = int(input())
	(prevP, prevC) = map(int, input().split())
	fl = prevP >= prevC
	for i in range(1, n):
		(p, c) = map(int, input().split())
		if p < c:
			fl = 0
		if p < prevP or c < prevC:
			fl = 0
		if p - prevP < c - prevC:
			fl = 0
		(prevP, prevC) = (p, c)
	if fl:
		print('YES')
	else:
		print('NO')


def OK(n, a, b):
	for i in range(1, n + 1):
		if a[i] < a[i - 1] or b[i] < b[i - 1]:
			return False
		if a[i] == a[i - 1] and b[i] != b[i - 1]:
			return False
		if a[i] > a[i - 1] and b[i] - b[i - 1] > a[i] - a[i - 1]:
			return False
	return True
t = int(input())
for k in range(t):
	n = int(input())
	a = [0]
	b = [0]
	for i in range(n):
		(aa, bb) = map(int, input().split())
		a.append(aa)
		b.append(bb)
	if OK(n, a, b):
		print('YES')
	else:
		print('NO')


I = input
for _ in range(int(I())):
	n = int(I())
	d = [tuple(map(int, I().split())) for _ in range(n)]
	(pp, pc) = (0, 0)
	f = 1
	for i in range(n):
		(p, c) = (d[i][0], d[i][1])
		if (p - pp < 0 or c - pc < 0) or p - pp < c - pc:
			print('NO')
			f = 0
			break
		(pp, pc) = (p, c)
	if f:
		print('YES')


t = int(input())
for j in range(t):
	n = int(input())
	kol = []
	(f, g) = map(int, input().split())
	kol.append([f, g])
	flag = 0
	if g > f:
		print('NO')
		flag = 1
	for i in range(n - 1):
		(p, c) = map(int, input().split())
		kol.append([p, c])
		if (c > p or kol[i][0] > p or kol[i][1] > c or (p - kol[i][0] < c - kol[i][1])) and flag == 0:
			print('NO')
			flag = 1
	if flag == 0:
		print('YES')


def case():
	n = int(input())
	poss = True
	(pa, pp) = (0, 0)
	for i in range(n):
		(a, p) = list(map(int, input().split()))
		if a < pa or p < pp or p > a or (p - pp > a - pa):
			poss = False
		(pa, pp) = (a, p)
	if poss:
		print('YES')
	else:
		print('NO')

def main():
	tc = int(input())
	for i in range(tc):
		case()
main()


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	for k in range(n):
		l.append(list(map(int, input().split())))
	c = 0
	temp = l[0][0]
	temp1 = l[0][1]
	if temp < temp1:
		c = 1
		print('NO')
	else:
		for j in range(1, n):
			if l[j][1] >= temp1 and l[j][0] >= temp + (l[j][1] - temp1):
				temp = l[j][0]
				temp1 = l[j][1]
			else:
				c = 1
				print('NO')
				break
	if c == 0:
		print('YES')


T = int(input())
t = 0
while t < T:
	t += 1
	begun = 0
	N = int(input())
	n = 0
	flg = 0
	while n < N:
		n += 1
		(p, c) = map(int, input().split())
		if not begun:
			begun = 1
			prev_p = p
			prev_c = c
			if p < c:
				flg = 1
			continue
		if p - prev_p < 0:
			flg = 1
		elif c - prev_c < 0:
			flg = 1
		elif p - prev_p < c - prev_c:
			flg = 1
		elif p < c:
			flg = 1
		prev_c = c
		prev_p = p
	if flg:
		print('NO')
	else:
		print('YES')


import math

def dtb(n):
	return bin(n).replace('0b', '')

def btd(n):
	return int(n, 2)
t = int(input())
for k in range(t):
	n = int(input())
	(p0, c0) = (0, 0)
	flag = 0
	for i in range(n):
		(p, c) = map(int, input().split())
		if p >= p0 and c >= c0:
			if p >= c:
				if p - p0 >= c - c0:
					p0 = p
					c0 = c
				else:
					flag = 1
			else:
				flag = 1
		else:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = []
	for t in range(n):
		k = list(map(int, input().split()))
		l.append(k)
	ok = 1
	p = l[0][0]
	c = l[0][1]
	if p < c:
		ok = 0
	for t in range(1, n):
		cp = l[t][0]
		cc = l[t][1]
		if cp < cc:
			ok = 0
			break
		if cp < p or cc < c:
			ok = 0
			break
		z = cc - c
		if cp - p < z:
			ok = 0
			break
		c = cc
		p = cp
	print('YES' if ok else 'NO')


tests = int(input())
for ii in range(tests):
	n = int(input())
	a = []
	g = True
	for i in range(n):
		(x, y) = map(int, input().split())
		a.append([x, y])
	x = 0
	y = 0
	for i in range(n):
		if a[i][0] >= x and a[i][1] >= y and (a[i][0] - x >= a[i][1] - y):
			x = a[i][0]
			y = a[i][1]
			continue
		g = False
		break
	print('YES') if g else print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list()
	flag = 0
	for i in range(n):
		(x, y) = map(int, input().split())
		a.append([x, y])
	if a[0][0] < a[0][1]:
		flag = 1
	else:
		for i in range(1, n):
			if a[i][0] - a[i - 1][0] < a[i][1] - a[i - 1][1]:
				flag = 1
				break
			if a[i][0] < a[i][1]:
				flag = 1
				break
			if a[i][0] < a[i - 1][0]:
				flag = 1
				break
			if a[i][1] < a[i - 1][1]:
				flag = 1
				break
	if flag == 1:
		print('No')
	else:
		print('Yes')


t = int(input())

def solve(T):
	S = []
	stats = int(input())
	for i in range(stats):
		S.append(list(map(int, input().split())))
	alert = False
	if S[0][0] < S[0][1]:
		alert = True
	for i in range(1, stats):
		if S[i][0] - S[i - 1][0] < S[i][1] - S[i - 1][1]:
			alert = True
			break
		if S[i][0] - S[i - 1][0] < 0 or S[i][1] - S[i - 1][1] < 0:
			alert = True
			break
		if S[i][0] < S[i][1]:
			alert = True
			break
	if alert == False:
		print('YES')
	if alert == True:
		print('NO')
for i in range(t):
	solve(i)


from sys import stdin
inFile = stdin
tokens = []
tokens_next = 0

def next_str():
	global tokens, tokens_next
	while tokens_next >= len(tokens):
		tokens = inFile.readline().split()
		tokens_next = 0
	tokens_next += 1
	return tokens[tokens_next - 1]

def nextInt():
	return int(next_str())
T = nextInt()
for _ in range(T):
	n = nextInt()
	res = True
	(p, c) = (0, 0)
	for i in range(n):
		(curP, curC) = (nextInt(), nextInt())
		if curP < p:
			res = False
		diff_p = curP - p
		diff_c = curC - c
		if diff_c > diff_p or diff_c < 0:
			res = False
		(p, c) = (curP, curC)
	print('YES' if res else 'NO')


import sys
input = sys.stdin.readline
import heapq
import copy

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def bin_search(arr, l, r, val):
	if arr[r] <= val:
		return r + 1
	if r - l < 2:
		if arr[l] > val:
			return l
		else:
			return r
	mid = int((l + r) / 2)
	if arr[mid] <= val:
		return bin_search(arr, mid, r, val)
	else:
		return bin_search(arr, l, mid, val)

def main():
	tests = inp()
	mod = 1000000007
	for test in range(tests):
		flag = 1
		n = inp()
		c = []
		p = []
		for _ in range(n):
			[a, b] = inlt()
			p.append(a)
			c.append(b)
		if p[0] < c[0]:
			print('NO')
			continue
		for i in range(1, n):
			if not (p[i] >= p[i - 1] and c[i] >= c[i - 1] and (p[i] - p[i - 1] >= c[i] - c[i - 1]) and (p[i] >= c[i])):
				print('NO')
				flag = 0
				break
		if flag == 1:
			print('YES')
	return 0
main()


for _ in range(int(input())):
	n = int(input())
	plays = 0
	clears = 0
	impflag = 0
	for i in range(n):
		a = input().split(' ')
		a[0] = int(a[0])
		a[1] = int(a[1])
		if a[0] >= plays and a[1] >= clears and (a[0] - plays >= a[1] - clears) and (a[0] >= a[1]):
			plays = a[0]
			clears = a[1]
		else:
			impflag = 1
	if impflag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for it in range(t):
	n = int(input())
	co = True
	first = list(map(int, input().split()))
	p = first[0]
	c = first[1]
	if c > p:
		co = False
	for i in range(n - 1):
		l = list(map(int, input().split()))
		if l[0] < l[1]:
			co = False
		if l[0] < p:
			co = False
		if l[1] < c:
			co = False
		if l[0] - p < l[1] - c:
			co = False
		p = l[0]
		c = l[1]
	if co:
		print('YES')
	else:
		print('NO')


test_cases = int(input())
for t in range(test_cases):
	n_records = int(input())
	records = []
	for r in range(n_records):
		records.append(tuple(map(int, input().split())))
	(play, clear) = records[0]
	if clear > play:
		print('NO')
		continue
	for (idx, (play, clear)) in enumerate(records[1:], start=1):
		if clear > play:
			print('NO')
			break
		(prev_play, prev_clear) = records[idx - 1]
		if not (play >= prev_play and clear >= prev_clear and (clear - prev_clear <= play - prev_play)):
			print('NO')
			break
	else:
		print('YES')


import sys
input = sys.stdin.readline

def getInt():
	return int(input())

def getVars():
	return map(int, input().split())

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

def getStr():
	return input().strip()
t = getInt()
for _ in range(t):
	n = getInt()
	p1 = -1
	c1 = -1
	res = 'YES'
	for i in range(n):
		(p, c) = getVars()
		if not (p >= c and p >= p1 and (c >= c1) and (p - p1 >= c - c1)):
			res = 'NO'
		(p1, c1) = (p, c)
	print(res)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	play = []
	win = []
	done = True
	for i in range(n):
		(p, w) = map(int, input().split())
		play.append(p)
		win.append(w)
	for i in range(n):
		if play[i] < win[i]:
			done = False
			break
		if i == 0:
			continue
		deltaPlay = play[i] - play[i - 1]
		deltaWin = win[i] - win[i - 1]
		if deltaWin < 0 or deltaPlay < 0 or deltaWin > deltaPlay:
			done = False
			break
	if done:
		print('YES')
	else:
		print('NO')


T = int(input())
for loop in range(T):
	n = int(input())
	pc = []
	for i in range(n):
		(p, c) = map(int, input().split())
		pc.append([p, c])
	flag = True
	for i in range(n):
		if i == 0:
			(p, c) = pc[i]
		else:
			p = pc[i][0] - pc[i - 1][0]
			c = pc[i][1] - pc[i - 1][1]
		if p < 0 or c < 0 or p < c:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


def main():
	s = int(input())
	(x, y, possible) = (0, 0, True)
	for _ in range(s):
		(a, b) = map(int, input().split(' '))
		if b > a or a < x or b < y or (a - x < b - y):
			possible = False
		(x, y) = (a, b)
	print('YES' if possible else 'NO')
n = int(input())
for _ in range(n):
	main()


t = int(input())
for l in range(t):
	s = int(input())
	arr = []
	brr = []
	mark = True
	for r in range(s):
		(a, b) = map(int, input().split())
		if b > a:
			mark = False
		arr.append(a)
		brr.append(b)
	for i in range(1, s):
		if arr[i] < arr[i - 1]:
			mark = False
		if brr[i] < brr[i - 1]:
			mark = False
		if arr[i] - arr[i - 1] < brr[i] - brr[i - 1]:
			mark = False
	if mark:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	(lastp, lastc) = (0, 0)
	output = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if output == True:
			if p < c:
				output = False
			if p < lastp:
				output = False
			if c < lastc:
				output = False
			if p - lastp < c - lastc:
				output = False
			(lastp, lastc) = (p, c)
	print('YES' if output else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	PC = [list(map(int, input().split())) for _ in range(n)]
	(prev_p, prev_c) = PC[0]
	error = prev_p < prev_c
	if error:
		print('NO')
		continue
	for i in range(1, n):
		(p, c) = PC[i]
		if p < c or p - prev_p < c - prev_c or p < prev_p or (c < prev_c):
			error = True
			break
		prev_p = p
		prev_c = c
	print('NO' if error else 'YES')


for _ in range(int(input())):
	x = int(input())
	last = [0, 0]
	broke = False
	for jo in range(x):
		new = list(map(int, input().split()))
		if new[1] > new[0]:
			broke = True
		if new[1] < last[1] or new[0] < last[0]:
			broke = True
		if new[0] - last[0] < new[1] - last[1]:
			broke = True
		last = new
	if not broke:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
T = int(input())
for tests in range(T):
	n = int(input())
	PC = [tuple(map(int, input().split())) for i in range(n)]
	(p0, c0) = PC[0]
	if p0 < c0:
		print('NO')
		continue
	for i in range(1, n):
		(p0, c0) = PC[i - 1]
		(p1, c1) = PC[i]
		if p1 >= p0 and c1 >= c0 and (p1 - p0 >= c1 - c0):
			True
		else:
			print('NO')
			break
	else:
		print('YES')


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

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

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(moves, n):
	val = (moves + 1) // 2
	rem = moves - val
	sol = (val + 1) * (rem + 1)
	return sol < n

def sortSecond(val):
	return val[1]
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect
import functools as fnt
from decimal import Decimal

def solve():
	n = scanner()
	pc = []
	for i in range(n):
		pc.append(get_list())
	if pc[0][0] < pc[0][1]:
		print('NO')
		return
	for i in range(1, n):
		if pc[i][0] == pc[i - 1][0]:
			if pc[i][0] < pc[i][1]:
				print('NO')
				return
			elif pc[i][1] < pc[i - 1][1]:
				print('NO')
				return
			elif pc[i][1] - pc[i - 1][1] > pc[i][0] - pc[i - 1][0]:
				print('NO')
				return
		elif pc[i][0] < pc[i - 1][0]:
			print('NO')
			return
		elif pc[i][0] > pc[i - 1][0]:
			if pc[i][0] < pc[i][1]:
				print('NO')
				return
			elif pc[i][1] < pc[i - 1][1]:
				print('NO')
				return
			elif pc[i][1] - pc[i - 1][1] > pc[i][0] - pc[i - 1][0]:
				print('NO')
				return
	print('YES')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = scanner()
for i in range(t):
	solve()


t = int(input())
for tt in range(t):
	n = int(input())
	p = []
	c = []
	for i in range(n):
		pc = input().split()
		p.append(int(pc[0]))
		c.append(int(pc[1]))
	val = True
	for i in range(n):
		if p[i] < c[i]:
			val = False
			break
		if i != n - 1:
			if p[i] > p[i + 1]:
				val = False
				break
			if c[i] > c[i + 1]:
				val = False
				break
			if p[i + 1] - p[i] < c[i + 1] - c[i]:
				val = False
				break
	if val:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	flag = False
	l = list()
	l.append((0, 0))
	for i in range(n):
		(p, c) = map(int, input().split(' '))
		l.append((p, c))
	(p_old, c_old) = l[0]
	for i in range(1, n + 1):
		(p, c) = l[i]
		c_diff = c - c_old
		p_diff = p - p_old
		if c_diff > p_diff:
			flag = True
			break
		if c_diff < 0 or p_diff < 0:
			flag = True
			break
		(p_old, c_old) = (p, c)
	if flag:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	c = ''
	a = []
	g = []
	for i in range(int(input())):
		d = list(map(int, input().split()))
		if i == 0:
			x = d[0]
			y = d[1]
			if x < y:
				c = 'NO'
			a.append(x)
			g.append(y)
		else:
			if d[0] < x or d[1] < y:
				c = 'NO'
			if d[0] < d[1]:
				c = 'NO'
			if d[0] == x and d[1] != y:
				c = 'NO'
			a.append(d[0])
			g.append(d[1])
			if d[1] - y > d[0] - x:
				c = 'NO'
			x = d[0]
			y = d[1]
	if c == '':
		print('YES')
	else:
		print(c)


I = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	n = int(input())
	l = []
	f = 0
	(minp, minl) = (0, 0)
	for i in range(n):
		(a, b) = I()
		if a < b:
			f = 1
		if i != 0 and ((minp > a or minl > b) or a - minp < b - minl):
			f = 1
		minp = max(minp, a)
		minl = max(minl, b)
		l.append([a, b])
	print('YNEOS'[f::2])


from sys import stdin, stdout
t = int(stdin.readline())
while t > 0:
	n = int(stdin.readline())
	stat = []
	for i in range(n):
		(p, c) = map(int, stdin.readline().split())
		stat.append([p, c])
	(curP, curC) = (stat[0][0], stat[0][1])
	correct = True
	if curC > curP:
		correct = False
	for i in range(1, n):
		(p, c) = (stat[i][0], stat[i][1])
		if p > curP:
			d = p - curP
			if c < curC:
				correct = False
				break
			if c > curC + d:
				correct = False
				break
		elif p < curP or c < curC:
			correct = False
			break
		elif p == curP and (c > curC or c < curC):
			correct = False
			break
		curP = p
		curC = c
	if correct:
		stdout.write('YES\n')
	else:
		stdout.write('NO\n')
	t -= 1


for _ in range(int(input())):
	(pi, ci) = (0, 0)
	flag = True
	for i in range(int(input())):
		(p, c) = map(int, input().split())
		if flag and (p - c < pi - ci or pi > p or ci > c):
			print('NO')
			flag = False
		(pi, ci) = (p, c)
	if flag:
		print('YES')


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	(p, c) = map(int, input().split())
	ans = True
	if c > p:
		ans = False
	for _ in range(n - 1):
		(p_t, c_t) = map(int, input().split())
		if ans:
			if p_t < p or c_t < c or c_t > p_t or (p_t - p < c_t - c):
				ans = False
			(p, c) = (p_t, c_t)
	print('YES') if ans else print('NO')


from collections import *
import sys
try:
	inp = raw_input
except:
	inp = input

def err(s):
	sys.stderr.write('{}\n'.format(s))

def ni():
	return int(inp())

def nl():
	return [int(_) for _ in inp().split()]
T = ni()
for _ in range(T):
	N = ni()
	(lp, lc) = (0, 0)
	fail = False
	for _ in range(N):
		(p, c) = nl()
		dp = p - lp
		dc = c - lc
		(lp, lc) = (p, c)
		if dp < dc or dc < 0:
			fail = True
	if fail:
		print('NO')
	else:
		print('YES')


T = int(input())
for _ in range(T):
	n = int(input())
	flag = 0
	for i in range(n):
		(p, c) = list(map(int, input().split()))
		if i == 0:
			q1 = p
			q2 = c
		if p < q1:
			flag = 1
		if c < q2:
			flag = 1
		if p < c:
			flag = 1
		if i >= 1:
			if p - q1 < c - q2:
				flag = 1
			q1 = p
			q2 = c
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	pp = 0
	pc = 0
	f = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if p < c or p < pp or c < pc or (p - pp < c - pc):
			f = False
		pp = p
		pc = c
	if f:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	C0 = -1
	C1 = -1
	d = False
	for i in range(n):
		(c0, c1) = (int(i) for i in input().split())
		if c1 > c0 or c0 < C0 or c1 < C1 or (c1 - C1 > c0 - C0):
			d = True
		C0 = c0
		C1 = c1
	if d:
		print('NO')
	else:
		print('YES')


tll = int(input())
temp = tll
while tll > 0:
	tll -= 1
	p_l = 0
	c_l = 0
	n = int(input())
	flag = True
	m_diff = 0
	while n > 0:
		n -= 1
		(p, c) = map(int, input().split())
		if not (p >= p_l and c <= p and (c >= c_l) and (p - c >= m_diff)):
			flag = False
		p_l = p
		c_l = c
		m_diff = max(m_diff, p - c)
	if flag:
		print('YES')
	else:
		print('NO')


from collections import defaultdict, Counter
import math as m
t = int(input())
for _ in range(t):
	n = int(input())
	prevn = -1
	prevm = -1
	f = 0
	for i in range(n):
		(n, m) = map(int, input().strip().split())
		newplays = n - prevn
		newwin = m - prevm
		if n < prevn or m < prevm or n < m or (prevn != -1 and newplays < newwin):
			f = 1
		prevn = n
		prevm = m
	if f:
		print('NO')
	else:
		print('YES')


import sys
from math import sqrt, floor
from collections import deque, Counter
inp = sys.stdin.readline
read = lambda : list(map(int, inp().split()))

def a():
	ans = ''
	for _ in range(int(inp())):
		n = int(inp())
		last = [0, 0]
		flag = 1
		for i in range(n):
			arr = read()
			if arr[0] < last[0]:
				flag = 0
			if arr[1] < last[1]:
				flag = 0
			if arr[0] < arr[1]:
				flag = 0
			if arr[0] - last[0] < arr[1] - last[1]:
				flag = 0
			last = arr
		ans += 'YNEOS'[not flag::2] + '\n'
	print(ans)
a()


t = int(input())

def game(p, c):
	flag = 'YES'
	if p[0] < c[0]:
		flag = 'NO'
		return flag
	for i in range(1, n):
		if p[i] - p[i - 1] == 0 and abs(c[i] - c[i - 1]) != 0:
			flag = 'NO'
			return flag
		if p[i] - p[i - 1] < c[i] - c[i - 1]:
			flag = 'NO'
			return flag
		if p[i] < c[i]:
			flag = 'NO'
			return flag
		elif p[i - 1] > p[i]:
			flag = 'NO'
			return flag
		elif c[i - 1] > c[i]:
			flag = 'NO'
			return flag
	return flag
for _ in range(t):
	n = int(input())
	p = []
	c = []
	for i in range(n):
		(a, b) = map(int, input().split())
		p.append(a)
		c.append(b)
	print(game(p, c))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	flag = 0
	k = 0
	l = 0
	A = []
	for i in range(n):
		(p, c) = map(int, input().split())
		if p - k < c - l:
			flag = 1
		if p == k and l > c:
			flag = 1
		if p < k or c < l:
			flag = 1
		if p < c:
			flag = 1
		k = p
		l = c
	print('YES') if flag == 0 else print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	(prev_p, prev_c) = (0, 0)
	answer = 'YES'
	for _ in range(n):
		(p, c) = list(map(int, input().split()))
		if p < prev_p or c < prev_c or c - prev_c > p - prev_p:
			answer = 'NO'
		prev_p = p
		prev_c = c
	print(answer)


from math import gcd, sqrt, ceil

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def main():
	for _ in range(ii()):
		n = ii()
		f = 0
		a = []
		for i in range(n):
			a.append(li())
		if a[0][0] < a[0][1]:
			f = 1
		for i in range(1, n):
			if a[i][0] < a[i - 1][0] or a[i][1] < a[i - 1][1]:
				f = 1
				break
			if a[i][0] < a[i][1]:
				f = 1
				break
			if a[i][1] > a[i - 1][1]:
				x = a[i][1] - a[i - 1][1]
				if a[i][0] < a[i - 1][0] + x:
					f = 1
					break
		if f:
			print('NO')
		else:
			print('YES')
main()


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
for _ in range(ii()):
	n = ii()
	p = c = 0
	res = 'YES'
	for _ in range(n):
		(a, b) = mi()
		ap = a - p
		bc = b - c
		if min(ap, bc) < 0 or ap < bc:
			res = 'NO'
		(p, c) = (a, b)
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	(l, p) = ([], [])
	for i in range(n):
		(a, b) = map(int, input().split())
		l.append(a)
		p.append(b)
	if n == 1 and l[0] < p[0]:
		print('NO')
	elif n == 1 and l[0] >= p[0]:
		print('YES')
	else:
		for i in range(1, n):
			f = 0
			if l[0] < p[0]:
				f = 1
				break
			if max(l[0:i]) > l[i] or max(p[0:i]) > p[i] or l[i] < p[i] or (l[i] - l[i - 1] < p[i] - p[i - 1]):
				f = 1
				break
		if f == 1:
			print('NO')
		else:
			print('YES')


T = int(input())
for _ in range(T):
	n = int(input())
	(ap, bp) = (None, None)
	res = True
	for __ in range(n):
		(a, b) = map(int, input().split())
		if b > a:
			res = False
		if ap is not None:
			if a < ap:
				res = False
			if b < bp:
				res = False
			if b - bp > a - ap:
				res = False
		(ap, bp) = (a, b)
	print('YES' if res else 'NO')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	n = inp()
	(a, b) = (0, 0)
	has = True
	for i in range(n):
		(play, clear) = invr()
		if play > a:
			clear_lim = play - a
			if clear >= b:
				if clear - b > clear_lim:
					has = False
			else:
				has = False
		elif play < a:
			has = False
		elif clear < b or clear > b:
			has = False
		(a, b) = (play, clear)
	if has:
		print('YES')
	else:
		print('NO')


t = int(input())

def count():
	(n, playsandclears, flag) = (int(input()), [], True)
	for i in range(n):
		playsandclears.append(list(map(int, input().split(' '))))
	for i in range(n):
		if playsandclears[i][0] < playsandclears[i][1]:
			flag = False
			break
		try:
			if playsandclears[i][1] > playsandclears[i + 1][1] or playsandclears[i][0] > playsandclears[i + 1][0] or playsandclears[i + 1][1] - playsandclears[i][1] > playsandclears[i + 1][0] - playsandclears[i][0]:
				flag = False
				break
		except:
			continue
		else:
			flag = True
	if flag:
		return 'YES'
	else:
		return 'NO'
for i in range(t):
	print(count())


for _ in range(int(input())):
	n = int(input())
	c1 = 0
	p1 = 0
	flag = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if p >= p1 and c >= c1 and (p >= c) and (p - p1 >= c - c1):
			c1 = c
			p1 = p
		else:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, PC):
	if all((p >= c for (p, c) in PC)):
		for ((p1, c1), (p2, c2)) in zip(PC, PC[1:]):
			deltaP = p2 - p1
			deltaC = c2 - c1
			if deltaP < 0 or deltaC < 0 or deltaC > deltaP:
				return 'NO'
		return 'YES'
	return 'NO'
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N,) = [int(x) for x in input().split()]
	PC = [[int(x) for x in input().split()] for i in range(N)]
	ans = solve(N, PC)
	print(ans)


import itertools
test = int(input())
out_ = []
for _ in range(test):
	n = int(input())
	p_list = []
	c_list = []
	for i in range(n):
		(a, b) = map(int, input().split(' '))
		p_list.append(a)
		c_list.append(b)
	flag = 0
	last_a = 0
	last_b = 0
	diff_a = 0
	diff_b = 0
	for (a, b) in zip(p_list, c_list):
		diff_a = a - last_a
		diff_b = b - last_b
		if b <= a and diff_b <= diff_a:
			if a >= last_a and b >= last_b:
				last_a = a
				last_b = b
			else:
				flag = 1
				break
		else:
			flag = 1
			break
	if flag == 0:
		out_.append('YES')
	else:
		out_.append('NO')
for o in out_:
	print(o)


t = int(input())
for i in range(t):
	n = int(input())
	q = 0
	f = 0
	r = 0
	for j in range(n):
		(p, c) = map(int, input().split())
		if p < q or c < r:
			f = 1
		elif p - q < c - r:
			f = 1
		q = p
		r = c
	if f == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	count = 0
	count1 = 0
	ans = 'YES'
	for _ in range(n):
		(a, b) = map(int, input().split())
		if a < count or b < count1 or a < b or (a - count < b - count1):
			ans = 'NO'
		else:
			count = a
			count1 = b
	print(ans)


t = int(input())
flag = True
for i in range(t):
	n = int(input())
	pk = -1
	ck = -1
	flag = True
	if n == 1:
		(p, c) = map(int, input().split())
		if c > p:
			flag = False
	else:
		for j in range(n):
			(p, c) = map(int, input().split())
			if c > p:
				flag = False
			elif pk > p or ck > c:
				flag = False
			elif c - ck > p - pk:
				flag = False
			pk = p
			ck = c
	if flag:
		print('YES')
	else:
		print('NO')


def solve():
	lis = []
	flag = True
	n = int(input())
	for _ in range(n):
		lis.append([int(x) for x in input().split()])
	if n == 1:
		if lis[0][0] < lis[0][1]:
			flag = False
		else:
			flag = True
	else:
		for i in range(n - 1):
			p = lis[i][0]
			c = lis[i][1]
			p1 = lis[i + 1][0]
			c1 = lis[i + 1][1]
			if p1 < p or c1 < c or p1 - p < c1 - c or (p < c):
				flag = False
				break
	if flag:
		print('YES')
	else:
		print('NO')
try:
	t = int(input())
	for _ in range(t):
		solve()
except:
	pass


t = int(input())
for _ in range(t):
	n = int(input())
	(p, c) = ([], [])
	ans = True
	for _ in range(n):
		(pp, cc) = map(int, input().split())
		p.append(pp)
		c.append(cc)
		if cc > pp:
			ans = False
		if len(p) > 1:
			dp = p[-1] - p[-2]
			dc = c[-1] - c[-2]
			if dp < 0 or dc < 0 or dp < dc:
				ans = False
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	(pi, ci) = (0, 0)
	flag = 0
	for j in range(n):
		inp = input().split(' ')
		(pf, cf) = (int(inp[0]), int(inp[1]))
		if pf - pi >= cf - ci and cf - ci >= 0 and (pf - pi >= 0):
			(pi, ci) = (pf, cf)
		else:
			flag = 1
	else:
		if flag == 1:
			print('NO')
		else:
			print('YES')


from collections import defaultdict as df
from sys import stdin, stdout
t = int(input())
for ii in range(t):
	n = int(stdin.readline())
	c = []
	flag = 0
	for i in range(n):
		(a, b) = list(map(int, stdin.readline().split()))
		c.append((a, b))
	prev = c[0][0]
	prev1 = c[0][1]
	if n == 1:
		if c[0][0] < c[0][1]:
			print('NO')
		else:
			print('YES')
		continue
	if c[0][0] < c[0][1]:
		print('NO')
		continue
	for i in range(1, n):
		if c[i][0] - c[i - 1][0] < c[i][1] - c[i - 1][1]:
			flag = 1
			break
		elif c[i][0] < c[i - 1][0]:
			flag = 1
			break
		elif c[i][1] < c[i - 1][1]:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	p_count = 0
	c_count = 0
	inputs = []
	for i in range(n):
		(p, c) = map(int, input().split())
		inputs.append([p, c])
	i = 0
	while i < n:
		(p, c) = inputs[i]
		if p < c:
			print('NO')
			break
		delta_p = p - p_count
		delta_c = c - c_count
		if delta_p < delta_c:
			print('NO')
			break
		if delta_p < 0 or delta_c < 0:
			print('NO')
			break
		i += 1
		p_count = p
		c_count = c
	if i == n:
		print('YES')


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

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
for __ in range(int(input())):
	n = int(input())
	arr = [[]] * n
	for i in range(n):
		arr[i] = I()
	if arr[0][0] < arr[0][1]:
		print('NO')
		continue
	f = 1
	for i in range(1, n):
		if not (arr[i][0] >= arr[i - 1][0] and arr[i][1] >= arr[i - 1][1] and (arr[i][1] - arr[i - 1][1] <= arr[i][0] - arr[i - 1][0]) and (arr[i][0] >= arr[i][1])):
			print('NO')
			f = 0
			break
	if f:
		print('YES')


t = int(input())
for test in range(t):
	n = int(input())
	prev_attempts = 0
	prev_clears = 0
	flag = True
	for inputs in range(n):
		(attempts, clears) = input().split()
		(attempts, clears) = (int(attempts), int(clears))
		delta_a = attempts - prev_attempts
		delta_c = clears - prev_clears
		prev_attempts = attempts
		prev_clears = clears
		if delta_a < 0 or delta_c < 0:
			flag = False
		if delta_c > delta_a:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


def solve():
	N = int(input())
	arr = []
	for _ in range(N):
		arr.append(list(map(int, input().split())))
	(p, c, diff) = (0, 0, 0)
	for (newp, newc) in arr:
		if newp < p or newc < c or newp < newc:
			return 'NO'
		if newp - newc < diff:
			return 'NO'
		(p, c) = (max([p, newp]), max([c, newc]))
		diff = max([diff, newp - newc])
	return 'YES'
T = int(input())
for t in range(T):
	print(solve())


for _ in range(int(input())):
	n = int(input())
	flag = 1
	lst = []
	for i in range(n):
		lst.append(tuple(map(int, input().split())))
	if lst[0][0] < lst[0][1]:
		print('NO')
		flag = 0
	if flag == 1:
		for i in range(1, n):
			if lst[i][0] < lst[i][1]:
				print('NO')
				flag = 0
				break
			if lst[i][0] < lst[i - 1][0] or lst[i][1] < lst[i - 1][1]:
				print('NO')
				flag = 0
				break
			elif lst[i][0] - lst[i - 1][0] < lst[i][1] - lst[i - 1][1]:
				print('NO')
				flag = 0
				break
	if flag == 1:
		print('YES')


test = int(input())
for _ in range(test):
	n = int(input())
	ok = True
	p = c = 0
	for _ in range(n):
		(p_i, c_i) = [int(x) for x in input().split()]
		a = p_i - p
		b = c_i - c
		if a < 0 or b < 0 or b > a:
			ok = False
		p = p_i
		c = c_i
	print('YES' if ok else 'NO')


t = int(input())

def valid(p1, c1, p2, c2):
	if p1 >= c1 and p2 >= c2 and (0 <= c2 - c1 <= p2 - p1):
		return True
	else:
		return False
for tc in range(t):
	numpeeks = int(input())
	peeks = []
	for k in range(numpeeks):
		(p, c) = map(int, input().split())
		peeks.append([p, c])
	no = False
	if numpeeks == 1:
		if peeks[0][0] >= peeks[0][1]:
			print('YES')
		else:
			print('NO')
		continue
	for p in range(1, numpeeks):
		if valid(peeks[p - 1][0], peeks[p - 1][1], peeks[p][0], peeks[p][1]) == True:
			continue
		else:
			no = True
	if no == True:
		print('NO')
	else:
		print('YES')


from sys import stdin
input = stdin.readline

def A():
	t = int(input())
	for _ in range(t):
		n = int(input())
		(p, c) = ([0] * n, [0] * n)
		succ = True
		for i in range(n):
			(p[i], c[i]) = map(int, input().split())
		if p[0] < c[0]:
			succ = False
		else:
			for i in range(1, n):
				if c[i] - c[i - 1] > p[i] - p[i - 1] or c[i] < c[i - 1] or p[i] < p[i - 1]:
					succ = False
					break
		if succ:
			print('YES')
		else:
			print('NO')
	return

def B():
	return

def C():
	return

def D():
	return
A()


t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	for i in range(n):
		l.append(list(map(int, input().split())))
	ans = 'YES'
	if l[0][0] < l[0][1]:
		ans = 'NO'
	else:
		for i in range(1, n):
			if l[i][0] >= l[i][1] and l[i][0] - l[i - 1][0] >= l[i][1] - l[i - 1][1] and (l[i][0] >= l[i - 1][0]) and (l[i][1] >= l[i - 1][1]):
				continue
			else:
				ans = 'NO'
				break
	print(ans)


for i in range(int(input())):
	n = int(input())
	(p, c) = (0, 0)
	ans = 0
	for i in range(n):
		(p1, c1) = map(int, input().split())
		if c1 - c <= p1 - p and p1 >= p and (c1 >= c):
			pass
		else:
			ans = 1
		(p, c) = (p1, c1)
	if ans == 1:
		print('NO')
	else:
		print('YES')


tt = int(input())
while tt:
	n = int(input())
	(t_a, t_b) = [int(x) for x in input().split()]
	n -= 1
	ans = True
	if t_b > t_a:
		ans = False
	while n:
		(a, b) = [int(x) for x in input().split()]
		if a < t_a or b < t_b or b > a:
			ans = False
		if abs(a - t_a) < abs(b - t_b):
			ans = False
		t_b = b
		t_a = a
		n -= 1
	if ans:
		print('YES')
	else:
		print('NO')
	tt -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	pp = []
	cc = []
	for i in range(n):
		(p, c) = input().split()
		pp.append(int(p))
		cc.append(int(c))
	y = 0
	for i in range(1, n):
		if pp[i] < cc[i] or pp[i] < pp[i - 1] or cc[i] < cc[i - 1] or (pp[i] - pp[i - 1] < cc[i] - cc[i - 1]):
			y = 1
			break
	if n == 1 and cc[0] > pp[0]:
		print('NO')
	elif y == 1 or cc[0] > pp[0]:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	pc = [list(map(int, input().split())) for i in range(n)]
	if n == 1:
		if pc[0][0] >= pc[0][1]:
			print('YES')
		else:
			print('NO')
		continue
	c = 0
	for i in range(n - 1):
		if pc[i][0] < pc[i][1] or pc[i + 1][0] - pc[i][0] < pc[i + 1][1] - pc[i][1] or pc[i][0] > pc[i + 1][0] or (pc[i][1] > pc[i + 1][1]):
			print('NO')
			c = 1
			break
	if c == 0:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	bol = True
	last_p = 0
	last_c = 0
	for j in range(n):
		(p, c) = map(int, input().split())
		if p < last_p or c < last_c or p < c or (p - last_p < c - last_c):
			bol = False
		last_p = p
		last_c = c
	if bol:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	k = int(input())
	d = []
	f = 0
	e = 0
	(p, q) = (0, 0)
	for i in range(k):
		c = []
		(a, b) = list(map(int, input().split()))
		if b > a:
			f = 1
		c.append(a)
		c.append(b)
		d.append(c)
	if f == 0:
		for i in range(len(d) - 1):
			if d[i + 1][1] >= d[i][1] and d[i + 1][0] >= d[i][0]:
				p = d[i + 1][1] - d[i][1]
				q = d[i + 1][0] - d[i][0]
				if p > q:
					f = 1
					break
			else:
				f = 1
				break
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for j in range(t):
	n = int(input())
	f = True
	(x, y) = (0, 0)
	for i in range(n):
		(a, b) = map(int, input().split())
		if a < x or b < y or a - x < b - y:
			f = False
		(x, y) = (a, b)
	if f:
		print('YES')
	else:
		print('NO')


import sys
T = int(sys.stdin.readline().strip())
while T > 0:
	T -= 1
	n = int(sys.stdin.readline().strip())
	buff = [0, 0]
	flag = 1
	while n > 0:
		n -= 1
		(p, c) = list(map(int, sys.stdin.readline().strip().split()))
		if flag == 1 and p >= buff[0] and (buff[1] <= c <= p) and (p - buff[0] >= c - buff[1]):
			(buff[0], buff[1]) = (p, c)
		else:
			flag = -1
	print('yes' if flag == 1 else 'no')


T = int(input())
for _ in range(T):
	n = int(input())
	a = []
	b = []
	for i in range(n):
		(k, l) = map(int, input().split())
		a.append(k)
		b.append(l)
	diff1 = [0] * (n - 1)
	diff2 = [0] * (n - 1)
	for i in range(1, n):
		diff1[i - 1] = a[i] - a[i - 1]
		diff2[i - 1] = b[i] - b[i - 1]
	ans = True
	if a[0] < b[0] or a[0] < 0 or b[0] < 0:
		ans = False
	else:
		for i in range(n - 1):
			if diff1[i] < 0:
				ans = False
			elif diff2[i] < 0:
				ans = False
			elif diff1[i] < diff2[i]:
				ans = False
			elif diff1[i] == 0 and diff2[i] != 0:
				ans = False
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = []
	for i in range(n):
		(p, c) = map(int, input().split())
		a.append((p, c))
	flag = 1
	if a[0][0] < a[0][1]:
		flag = 0
		print('NO')
		continue
	i = 1
	while i < n:
		if a[i][0] >= a[i - 1][0] and a[i][1] >= a[i - 1][1] and (a[i][0] - a[i - 1][0] >= a[i][1] - a[i - 1][1]):
			flag = 1
		else:
			flag = 0
			break
		i += 1
	if flag == 1:
		print('YES')
	else:
		print('NO')


TEST = False

def solve(vals):
	res = ['NO', 'YES']
	(prev_p, prev_c) = (0, 0)
	(prev_p, prev_c) = (0, 0)
	for (p, c) in vals:
		delta_p = p - prev_p
		delta_c = c - prev_c
		if p < c or p < prev_p or c < prev_c or (delta_p < delta_c):
			return res[0]
		(prev_p, prev_c) = (p, c)
	return res[1]
s_in = '\n7\n3\n0 0\n1 1\n1 2\n2\n1 0\n1000 3\n4\n10 1\n15 2\n10 2\n15 2\n1\n765 432\n2\n4 4\n4 3\n5\n0 0\n1 0\n1 0\n1 0\n1 0\n3\n0 0\n2 1\n2 2\n'
s_out = '\nNO\nYES\nNO\nYES\nNO\nYES\nNO\n'
l_in = list(reversed(s_in.split('\n')[1:-1]))
l_out = list(reversed(s_out.split('\n')[1:-1]))
if TEST:
	tc = []
	t = int(l_in.pop())
	for ti in range(t):
		n = int(l_in.pop())
		vals = []
		for ni in range(n):
			(p, c) = list(map(int, l_in.pop().split()))
			vals.append((p, c))
		sol = l_out.pop().strip()
		tc.append([vals, sol])
	print('\n*** tc ***')
	for test in tc:
		print(test)
	print('*** tc ***\n')
	for (vals, sol) in tc:
		res = solve(vals)
		print(res, sol, res == sol)
else:
	t = int(input())
	for ti in range(t):
		n = int(input())
		vals = []
		for ni in range(n):
			(p, c) = list(map(int, input().split()))
			vals.append((p, c))
		res = solve(vals)
		print(f'{res}')


t = int(input())
for i in range(t):
	ok = True
	n = int(input())
	(pi, ci) = map(int, input().split())
	if pi < ci:
		ok = False
	for i in range(n - 1):
		(pi2, ci2) = map(int, input().split())
		if pi2 < pi or ci2 < ci or ci2 - ci > pi2 - pi or (pi2 < ci2):
			ok = False
		(pi, ci) = (pi2, ci2)
	if ok == True:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
for _ in range(t):
	n = int(input())
	play = []
	clear = []
	flag = 1
	for _ in range(n):
		(n, m) = map(int, input().split())
		play.append(n)
		clear.append(m)
	if play[0] < clear[0]:
		print('NO')
	else:
		for i in range(1, len(play)):
			if play[i] < play[i - 1] or clear[i] < clear[i - 1]:
				flag = 0
				break
			elif clear[i] > play[i]:
				flag = 0
				break
			elif play[i] - play[i - 1] < clear[i] - clear[i - 1]:
				flag = 0
				break
		if flag == 1:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	maxp = 0
	maxc = 0
	ans = 1
	for i in range(n):
		(p, c) = map(int, input().split())
		if i == 0:
			maxp = p
			maxc = c
		elif p == maxp and c != maxc:
			ans = 0
		elif p - maxp < c - maxc:
			ans = 0
		else:
			if p < maxp:
				ans = 0
			else:
				maxp = p
			if c < maxc:
				ans = 0
			else:
				maxc = c
		if c > p:
			ans = 0
	print('YES' if ans is 1 else 'NO')


import sys
readline = sys.stdin.readline
flush = sys.stdout.flush
T = int(readline())
for t in range(1, T + 1):
	N = int(readline())
	attempts = successes = 0
	ans = 'YES'
	for i in range(N):
		line = readline().split()
		(a, s) = (int(line[0]), int(line[1]))
		if not (a >= attempts and s >= successes and (a - attempts >= s - successes)):
			ans = 'NO'
			while i < N - 1:
				i += 1
				readline()
			break
		(attempts, successes) = (a, s)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		a = list(map(int, input().split()))
		l.append(a)
	p = 0
	c = 0
	flag = 0
	for i in range(n):
		p1 = l[i][0]
		c1 = l[i][1]
		if p1 < p or c1 < c:
			flag = 1
			break
		elif p1 > p:
			pd = p1 - p
			cd = c1 - c
			if cd > pd:
				flag = 1
				break
		elif p1 == p:
			if c1 != c:
				flag = 1
				break
		p = p1
		c = c1
	if flag == 1:
		print('NO')
	else:
		print('YES')


def solve(n, arr):
	for i in range(1, n):
		if arr[i][0] < arr[i][1]:
			return 'NO'
		if arr[i][0] > arr[i - 1][0]:
			if arr[i][1] >= arr[i - 1][1]:
				if arr[i][0] - arr[i - 1][0] >= arr[i][1] - arr[i - 1][1]:
					pass
				else:
					return 'NO'
			else:
				return 'NO'
		elif arr[i][0] == arr[i - 1][0]:
			if arr[i][1] == arr[i - 1][1]:
				pass
			else:
				return 'NO'
		else:
			return 'NO'
	if arr[0][0] < arr[0][1]:
		return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	arr = []
	for i in range(n):
		a = list(map(int, input().split()))
		arr.append(a)
	print(solve(n, arr))


for _ in range(int(input())):
	n = int(input())
	big = []
	flag = 0
	for i in range(n):
		small = []
		(a, b) = map(int, input().split())
		small.append(a)
		small.append(b)
		big.append(small)
		if b > a:
			flag = 1
	if flag == 0:
		for i in range(len(big) - 1):
			if big[i + 1][1] >= big[i][1] and big[i + 1][0] >= big[i][0]:
				if big[i + 1][1] - big[i][1] > big[i + 1][0] - big[i][0]:
					flag = 1
					break
			else:
				flag = 1
				break
	if flag == 1:
		print('NO')
	else:
		print('YES')


T = int(input())
for _ in range(T):
	n = int(input())
	cur_p = cur_c = 0
	valid = True
	for _ in range(n):
		(p, c) = map(int, input().split())
		if not valid:
			continue
		if p < cur_p or c < cur_c or c > p or (p - cur_p < c - cur_c):
			print('NO')
			valid = False
		cur_p = p
		cur_c = c
	if valid:
		print('YES')


import sys
from copy import deepcopy
for t in range(int(input())):
	n = int(input())
	last_p = 0
	last_c = 0
	l = []
	for i in range(n):
		(p, c) = [int(j) for j in input().split()]
		l.append((p, c))
	for i in range(n):
		(p, c) = l[i]
		a = p - last_p
		b = c - last_c
		if a >= b and b >= 0:
			pass
		else:
			sys.stdout.write('NO')
			sys.stdout.write('\n')
			break
		last_c = c
		last_p = p
	else:
		sys.stdout.write('YES')
		sys.stdout.write('\n')


for _ in range(int(input())):
	n = int(input())
	ans = ''
	for i in range(n):
		(p, c) = map(int, input().split())
		if i == 0:
			prevp = p
			prevc = c
			if p < c:
				ans = 'NO'
		else:
			if p - prevp < c - prevc or c < prevc or p < prevp:
				ans = 'NO'
			elif p < c or p < prevc:
				ans = 'NO'
			prevp = p
			prevc = c
	if ans == '':
		ans = 'YES'
	print(ans)


for _ in range(int(input())):
	n = int(input())
	checks = []
	result = 'YES'
	for i in range(n):
		checks.append(list(map(int, input().split())))
		if result == 'YES' and (i == 0 and checks[i][0] < checks[i][1] or (i > 0 and (checks[i][0] < checks[i - 1][0] or checks[i][1] < checks[i - 1][1] or checks[i][0] - checks[i - 1][0] < checks[i][1] - checks[i - 1][1]))):
			result = 'NO'
	print(result)


for _ in range(int(input())):
	n = int(input())
	pairs = []
	for _ in range(n):
		(p, c) = map(int, input().split())
		pairs.append([p, c])
	flag = True
	for i in range(n - 1):
		[p1, c1] = pairs[i]
		[p2, c2] = pairs[i + 1]
		if p2 < p1 or c2 < c1 or p2 - p1 < c2 - c1 or (p2 < c2) or (p1 < c1):
			flag = False
			break
	if not flag or pairs[0][1] > pairs[0][0]:
		print('NO')
	else:
		print('YES')


T = int(input())
for _ in range(T):
	n = int(input())
	mina = 0
	minb = 0
	flag = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		if b - minb > a - mina or b - minb < 0 or a - mina < 0:
			flag = 1
		else:
			mina = a
			minb = b
	if flag == 1:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
T = int(stdin.readline())
for i in range(T):
	n = int(stdin.readline())
	pCur = 0
	cCur = 0
	res = 'YES'
	for j in range(n):
		[p, c] = [int(x) for x in stdin.readline().split()]
		if c <= p and p >= pCur and (c >= cCur) and (c - cCur <= p - pCur):
			pCur = p
			cCur = c
			continue
		else:
			res = 'NO'
	stdout.write(res + '\n')


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		(a, b) = map(int, input().split())
		if a < b:
			print('NO')
		else:
			print('YES')
	else:
		lst2 = []
		lst3 = []
		for i in range(n):
			(a, b) = map(int, input().split())
			lst2.append(a)
			lst3.append(b)
		yo = True
		for i in range(n - 1):
			if lst2[i] > lst2[i + 1]:
				yo = False
				break
			if lst3[i] > lst3[i + 1]:
				yo = False
				break
			if lst2[i] < lst3[i] or lst2[i + 1] < lst3[i + 1]:
				yo = False
				break
			if lst2[i + 1] - lst2[i] < lst3[i + 1] - lst3[i]:
				yo = False
				break
		if yo:
			print('YES')
		else:
			print('NO')


t = int(input())
while t > 0:
	n = int(input())
	attempts = []
	for i in range(n):
		attempts.append([int(i) for i in input().split()])
	if attempts[0][0] < attempts[0][1] or attempts[-1][0] < attempts[-1][1]:
		print('NO')
		t -= 1
		continue
	flag = 1
	for i in range(1, n):
		a = attempts[i][0] - attempts[i - 1][0]
		if a < 0 or attempts[i][1] - attempts[i - 1][1] < 0 or attempts[i][1] - attempts[i - 1][1] > a:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	lis = []
	for i in range(n):
		lis.append(list(map(int, input().split())))
	for i in range(1, n):
		(p1, c1, p2, c2) = (lis[i - 1][0], lis[i - 1][1], lis[i][0], lis[i][1])
		if c1 > p1 or c2 > p2 or p1 > p2 or (c1 > c2) or (c2 - c1 > p2 - p1):
			print('NO')
			break
	else:
		if n == 1 and lis[0][0] < lis[0][1]:
			print('NO')
		else:
			print('YES')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	P = 0
	C = 0
	f = 0
	for i in range(n):
		(p, c) = [int(x) for x in input().split()]
		if p >= P and c >= C and (p >= c):
			if p - P >= c - C:
				f += 1
		P = p
		C = c
	if f == n:
		print('YES')
	else:
		print('No')


tc = int(input().strip())
for t in range(tc):
	n = int(input().strip())
	arr = []
	for i in range(n):
		arr.append(tuple(map(int, input().strip().split())))
	ans = True
	for i in range(n):
		if i == 0:
			if arr[i][0] < arr[i][1]:
				ans = False
				break
		else:
			if arr[i - 1][0] > arr[i][0]:
				ans = False
				break
			if arr[i - 1][1] > arr[i][1]:
				ans = False
				break
			if arr[i][0] - arr[i - 1][0] < arr[i][1] - arr[i - 1][1]:
				ans = False
				break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	c = 0
	for i in range(n):
		(x, y) = [int(b) for b in input().split()]
		if len(l) == 0:
			l.append([x, y])
			if x < y:
				c = 1
		else:
			w = l.pop(0)
			p = w[0]
			q = w[1]
			if p == x:
				l.append([x, y])
				if q == y:
					continue
				else:
					c += 1
			elif x > p:
				l.append([x, y])
				if x - p >= y - q and y >= q:
					continue
				else:
					c += 1
			else:
				l.append([x, y])
				c += 1
	if c == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin
for _ in range(int(input())):
	res = 'YES'
	p = c = 0
	for _ in range(int(input())):
		(pt, ct) = list(map(int, stdin.readline().split()))
		if pt < p or ct < c:
			res = 'NO'
		elif pt - p < ct - c:
			res = 'NO'
		(p, c) = (pt, ct)
	print(res)


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

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

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	n = inputnum()
	played = []
	cleared = []
	for i in range(n):
		(p, c) = inputnums()
		played.append(p)
		cleared.append(c)
	done = False
	if played[0] < cleared[0]:
		print('NO')
		done = True
		continue
	for i in range(1, n):
		if played[i] - played[i - 1] < cleared[i] - cleared[i - 1] or played[i] < played[i - 1] or cleared[i] < cleared[i - 1]:
			print('NO')
			done = True
			break
	if not done:
		print('YES')


a = int(input())
for i in range(a):
	t = int(input())
	in1 = in2 = flag = 0
	for j in range(t):
		(a, b) = map(int, input().split())
		if a >= in1 and b >= in2 and (in1 >= in2) and (a - in1 >= b - in2):
			(in1, in2) = (a, b)
		else:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


T = int(input())
for _ in range(T):
	n = int(input())
	prev = 0
	gg = 0
	ggg = False
	for i in range(n):
		(a, b) = map(int, input().split())
		if not (prev <= a and gg <= b and (b <= a) and (a - prev >= b - gg)):
			ggg = True
		prev = a
		gg = b
	if ggg:
		print('NO')
	else:
		print('YES')


def solution():
	n = int(input())
	z = 0
	q = 0
	flag = 0
	for i in range(n):
		(x, y) = map(int, input().split())
		if x < z or x - z < y - q or y < q:
			flag = 1
		z = x
		q = y
	if flag == 0:
		print('YES')
	else:
		print('NO')
for _ in range(int(input())):
	solution()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	s = [list(map(int, input().split())) for _ in range(n)]
	prev = s[0]
	res = 'YES'
	if prev[0] < prev[1]:
		print('NO')
		continue
	for i in range(1, n):
		curr = s[i]
		if prev[0] > curr[0]:
			res = 'NO'
			break
		if prev[1] > curr[1]:
			res = 'NO'
			break
		if curr[0] - prev[0] < curr[1] - prev[1]:
			res = 'NO'
			break
		if curr[0] < curr[1]:
			res = 'NO'
			break
		prev = curr
	print(res)


def level_stat(n):
	xyz = input
	p = [0] * n
	c = [0] * n
	for i in range(n):
		tmp = [int(x) for x in xyz().split()]
		p[i] = tmp[0]
		c[i] = tmp[1]
	if p != sorted(p) or c != sorted(c):
		return 'NO'
	for i in range(n):
		if c[i] > p[i]:
			return 'NO'
		elif c[i] == p[i]:
			if i != 0:
				if p[i] - p[i - 1] != c[i] - c[i - 1]:
					return 'NO'
		elif i != 0:
			if p[i] - p[i - 1] < c[i] - c[i - 1]:
				return 'NO'
	return 'YES'
xyz = input
t = int(xyz())
for i1 in [0] * t:
	n = int(xyz())
	print(level_stat(n))


t = int(input())
for _ in range(t):
	n = int(input())
	ans = 'YES'
	for i in range(n):
		if i == 0:
			prev = tuple(map(int, input().split()))
			if prev[0] < prev[1]:
				ans = 'NO'
		else:
			cur = tuple(map(int, input().split()))
			if cur[1] < prev[1]:
				ans = 'NO'
			elif cur[0] < prev[0]:
				ans = 'NO'
			elif cur[1] - prev[1] > cur[0] - prev[0]:
				ans = 'NO'
			prev = cur
	print(ans)


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def get_str():
	return input().decode().strip()

def rint():
	return map(int, input().split())

def oint():
	return int(input())
T = oint()
for _ in range(T):
	n = oint()
	prev = [0, 0]
	ok = 1
	for i in range(n):
		cur = list(rint())
		diffp = cur[0] - prev[0]
		diffl = cur[1] - prev[1]
		if diffp < 0 or diffl < 0:
			ok = 0
		if diffp < diffl:
			ok = 0
		(prev[0], prev[1]) = (cur[0], cur[1])
	if ok == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(0, t):
	p1 = c1 = x = 0
	n = int(input())
	for j in range(0, n):
		(p, c) = [int(x) for x in input().split()]
		del_p = p - p1
		del_c = c - c1
		if del_p >= 0 and del_c >= 0 and (del_p >= del_c):
			x = x + 1
		p1 = p
		c1 = c
	if x == n:
		print('YES')
	else:
		print('NO')


test = int(input())
sol = []
while test:
	test -= 1
	n = int(input())
	a = [tuple(map(int, input().split())) for i in range(n)]
	if n == 1:
		x = 'YES'
		if a[0][0] < a[0][1]:
			x = 'NO'
		sol.append(x)
	else:
		i = 1
		x = 'YES'
		if a[0][1] > a[0][0]:
			x = 'NO'
		while i < n and x == 'YES':
			if a[i][0] < a[i][1]:
				x = 'NO'
				break
			elif a[i][0] < a[i - 1][0] or a[i][1] < a[i - 1][1]:
				x = 'NO'
				break
			elif a[i][0] == a[i - 1][0]:
				if a[i][1] != a[i - 1][1]:
					x = 'NO'
					break
			elif a[i][1] < a[i - 1][1]:
				x = 'NO'
				break
			elif a[i][1] - a[i - 1][1] > a[i][0] - a[i - 1][0]:
				x = 'NO'
				break
			i += 1
		sol.append(x)
for i in sol:
	print(i)


def correct(p, c):
	for i in range(len(p) - 1):
		if p[i] > p[i + 1] or c[i] > c[i + 1] or p[i] < c[i] or (p[i + 1] - p[i] < c[i + 1] - c[i]):
			return False
	if p[len(p) - 1] < c[len(p) - 1]:
		return False
	return True
t = int(input())
for q in range(t):
	n = int(input())
	p = []
	c = []
	for i in range(n):
		(m, n) = map(int, input().split())
		p.append(m)
		c.append(n)
	if correct(p, c):
		print('YES')
	else:
		print('NO')


from math import *
from copy import *
from string import *
from random import *
from bisect import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
from collections import defaultdict

def solve(L):
	n = len(L)
	f = 1
	diff = L[0][0] - L[0][1]
	if diff < 0:
		f = 0
	else:
		for i in range(1, n):
			currDiff = L[i][0] - L[i][1]
			if currDiff < 0 or currDiff < diff:
				f = 0
				break
			else:
				diff = currDiff
			if L[i][0] < L[i - 1][0] or L[i][1] < L[i - 1][1]:
				f = 0
				break
			if L[i][0] == L[i - 1][0] and L[i][1] != L[i - 1][1]:
				f = 0
				break
	return 'YES' if f else 'NO'
T = int(input())
for _ in range(T):
	N = int(stdin.readline())
	L = []
	for nn in range(N):
		l = list(map(int, stdin.readline().rstrip().split()))
		L.append(l)
	print(solve(L))


t = int(input())
for i in range(t):
	YesOrNo = True
	n = int(input())
	pc = []
	for j in range(n):
		a = input()
		pc.append((int(a.split()[0]), int(a.split()[1])))
	a = 0
	b = 0
	for (p, c) in pc:
		if p < c:
			YesOrNo = False
		if p < a or c < b:
			YesOrNo = False
		if c > b and p == a:
			YesOrNo = False
		if c > b and p < a + c - b:
			YesOrNo = False
		(a, b) = (p, c)
	if YesOrNo:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	for i in range(n):
		b = []
		(p, c) = input().split()
		p = int(p)
		c = int(c)
		b.append(p)
		b.append(c)
		a.append(b)
	d = -1
	for j in range(n):
		e = a[j][0]
		f = a[j][1]
		if a[j][0] < a[j][1]:
			d = j
			break
		if j < n - 1:
			diff1 = a[j + 1][0] - e
			diff2 = a[j + 1][1] - f
			if e > a[j + 1][0] or f > a[j + 1][1] or diff1 < diff2:
				d = j
	if d == -1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	p1 = 0
	c1 = 0
	t = 0
	l = []
	for i in range(n):
		(p, c) = map(int, input().split())
		l.append([p, c])
	for i in l:
		if i[0] - p1 >= 0 and i[1] - c1 >= 0:
			if i[0] - p1 < i[1] - c1:
				t = 1
				print('NO')
				break
			p1 = i[0]
			c1 = i[1]
		else:
			t = 1
			print('NO')
			break
	if t == 0:
		print('YES')


def solve():
	l = (0, 0)
	d = 0
	y = 1
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		if a - b >= d and a >= l[0] and (b >= l[1]):
			l = (a, b)
			d = a - b
		elif y:
			print('NO')
			y = 0
	if y:
		print('YES')
for t in range(int(input())):
	solve()


for _ in range(int(input())):
	(w, f) = (0, 0)
	flag = False
	for _ in range(int(input())):
		(x, y) = map(int, input().split())
		if x < w or y < f or x - w < y - f:
			flag = True
		else:
			w = x
			f = y
	print('YES' if flag == False else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	array = []
	for j in range(n):
		(p, c) = [int(s) for s in input().split()]
		array.append((p, c))
	flag = True
	for i in range(len(array) - 1):
		if array[i][0] > array[i + 1][0] or array[i][1] > array[i + 1][1] or array[i + 1][1] - array[i][1] > array[i + 1][0] - array[i][0]:
			flag = False
			break
	for i in range(len(array)):
		if array[i][0] < array[i][1]:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	p = [0] * n
	c = [0] * n
	for k in range(0, n):
		(p[k], c[k]) = map(int, input().split())
	if n == 1:
		if p[0] >= c[0]:
			print('YES')
		else:
			print('NO')
	else:
		s = 0
		for j in range(0, n - 1):
			if p[j] < c[j] or p[j + 1] - p[j] < c[j + 1] - c[j] or p[j + 1] < p[j] or (c[j + 1] < c[j]):
				s = 1
				break
		if p[n - 1] < c[n - 1]:
			s = 1
		if s == 1:
			print('NO')
		else:
			print('YES')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	q = [list(map(int, input().split())) for _ in range(n)]
	if q[0][0] < q[0][1]:
		print('NO')
		continue
	for i in range(n - 1):
		if q[i + 1][0] < q[i + 1][1] or q[i][0] > q[i + 1][0] or q[i][1] > q[i + 1][1] or (q[i + 1][0] - q[i][0] < q[i + 1][1] - q[i][1]):
			print('NO')
			break
	else:
		print('YES')


I = input
pr = print

def main():
	for _ in range(int(I())):
		(n, f) = (int(I()), 0)
		(pmax, cmax) = map(int, I().split())
		if pmax >= cmax:
			for _ in range(n - 1):
				if f:
					I()
					continue
				(p, c) = map(int, I().split())
				if p - pmax < 0 or c - cmax < 0 or p - pmax < c - cmax:
					pr('NO')
					f = 1
				pmax = p
				cmax = c
			if 1 - f:
				pr('YES')
		else:
			pr('NO')
			for _ in range(n - 1):
				I()
				continue
main()


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = [0]
	b = [0]
	for i in range(n):
		(c, d) = map(int, input().split())
		a.append(c)
		b.append(d)
	d = 0
	fl = 0
	for i in range(1, n + 1):
		if a[i] >= a[i - 1] and b[i] >= b[i - 1] and (a[i] >= b[i]) and (a[i] - b[i] >= d):
			d = a[i] - b[i]
		else:
			fl = 1
			break
	if fl:
		print('NO')
	else:
		print('YES')


t = int(input())
while t != 0:
	n = int(input())
	l = []
	for i in range(n):
		(a, b) = [int(i) for i in input().split()]
		l.append((a, b))
	if l[0][0] < l[0][1]:
		q = 0
	else:
		q = 1
	for i in range(1, n):
		if l[i][0] < l[i - 1][0]:
			q = 0
			break
		elif l[i][1] < l[i - 1][1]:
			q = 0
			break
		elif l[i][1] > l[i][0]:
			q = 0
			break
		elif l[i][1] - l[i - 1][1] > l[i][0] - l[i - 1][0]:
			q = 0
			break
	if q == 1:
		print('YES')
	else:
		print('NO')
	t = t - 1


for _ in range(int(input())):
	(n, c) = (int(input()), True)
	m = [tuple(map(int, input().split())) for i in range(n)]
	for i in range(1, n):
		(p1, c1) = m[i - 1]
		(p2, c2) = m[i]
		if p1 > p2 or c1 > c2 or p2 - p1 < c2 - c1:
			c = False
			break
	print('YES' if c and m[0][0] >= m[0][1] else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		(p, c) = map(int, input().strip().split())
		if p >= c:
			print('YES')
		else:
			print('NO')
	else:
		l = []
		k = []
		flag = 0
		for i in range(n):
			(p, c) = map(int, input().strip().split())
			if i == 0:
				if p >= c:
					l.append(p)
					k.append(c)
				else:
					flag = 1
					l.append(p)
					k.append(c)
			elif p > l[-1] and c >= k[-1] and (p >= c) and (p - l[-1] >= c - k[-1]):
				l.append(p)
				k.append(c)
			elif p == l[-1] and c == k[-1]:
				l.append(p)
				k.append(c)
			else:
				flag = 1
				l.append(p)
				k.append(c)
		if flag == 0:
			print('YES')
		else:
			print('NO')


t = int(input())
for q in range(t):
	n = int(input())
	c = []
	d = []
	count = 0
	for w in range(n):
		inp1 = str(input())
		inp = inp1.split()
		a = int(inp[0])
		b = int(inp[1])
		c.append(a)
		d.append(b)
		if a >= b and a >= c[w - 1] and (b >= d[w - 1]) and (a >= c[w - 1] + (b - d[w - 1])):
			continue
		else:
			count += 1
	if count == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for rep in range(t):
	n = int(input())
	p = 0
	c = 0
	f = 0
	for i in range(n):
		(pin, cin) = list(map(int, input().split()))
		if pin < p or cin < c or pin < cin or (pin - p < cin - c):
			f = 1
		else:
			p = pin
			c = cin
	if f == 0:
		print('YES')
	else:
		print('NO')


from collections import defaultdict as dd
import sys
input = sys.stdin.readline
t = int(input())
while t:
	n = int(input())
	lol = 0
	a = 0
	b = 0
	for i in range(n):
		(nn, mm) = map(int, input().split())
		if nn < a or mm < b or nn < mm:
			lol = 1
		if mm - b > nn - a:
			lol = 1
		a = nn
		b = mm
	if lol:
		print('NO')
	else:
		print('YES')
	t -= 1


def sol(p, c, n):
	if n == 1:
		if p[0] >= c[0]:
			return 'YES'
		else:
			return 'NO'
	for i in range(n - 1):
		if p[i] >= c[i] and p[i + 1] >= p[i] and (c[i + 1] >= c[i]) and (p[i + 1] >= c[i + 1]):
			if p[i + 1] >= p[i] + (c[i + 1] - c[i]):
				continue
			else:
				return 'NO'
		else:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	p = []
	c = []
	for i in range(n):
		(a, b) = map(int, input().split())
		p.append(a)
		c.append(b)
	v = sol(p, c, n)
	print(v)


def main():
	v = int(input())
	for i in range(v):
		c = int(input())
		data = [[int(s) for s in input().split()] for v in range(c)]
		c = -1
		l = -1
		s = True
		for (k, v) in data:
			if k == c and l != v:
				s = False
				break
			d = k - c
			ll = v - l
			l = v
			c = k
			if d < 0 or ll < 0:
				s = False
				break
			if d < ll:
				s = False
				break
		if s:
			print('YES')
		else:
			print('NO')

def convert(data):
	d = {}
	for (k, v) in enumerate(data):
		if v not in d:
			d[v] = []
		d[v].append(k)
	return d
main()


t = int(input())
for _ in range(t):
	n = int(input())
	prevp = 0
	prevc = 0
	ok = True
	for i in range(n):
		(p, c) = map(int, input().split())
		if not (c >= prevc and p - prevp >= c - prevc):
			ok = False
		prevp = p
		prevc = c
	if ok:
		print('YES')
	else:
		print('NO')


def read_int():
	n = int(input())
	return n

def read_ints():
	ints = [int(x) for x in input().split(' ')]
	return ints

def solve(n, stats):
	p0 = stats[0][0]
	c0 = stats[0][1]
	if c0 > p0:
		return 'NO'
	if n == 1:
		return 'YES'
	for i in range(len(stats) - 1):
		p = stats[i + 1][0]
		c = stats[i + 1][1]
		if p < p0:
			return 'NO'
		if c < c0:
			return 'NO'
		if c > p:
			return 'NO'
		if c - c0 > p - p0:
			return 'NO'
		p0 = p
		c0 = c
	return 'YES'
T = read_int()
for case in range(T):
	n = read_int()
	stats = []
	for i in range(n):
		(p, c) = read_ints()
		stats.append((p, c))
	sol = solve(n, stats)
	print(sol)


def main_function():
	t = int(input())
	for test_case in range(t):
		n = int(input())
		(p, c) = list(map(int, input().split()))
		flag = True
		if c > p:
			flag = False
		for i in range(n - 1):
			(new_p, new_c) = list(map(int, input().split()))
			if new_p < p or new_c < c or new_c > new_p or (new_c - c > new_p - p):
				flag = False
			(p, c) = (new_p, new_c)
		print('YES' if flag else 'NO')
main_function()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	CHECK = True
	(p1, c1) = (0, 0)
	n = int(input())
	for _ in range(n):
		(p2, c2) = map(int, input().split())
		if p2 - p1 >= c2 - c1 and c2 - c1 >= 0:
			None
		else:
			CHECK = False
		(p1, c1) = (p2, c2)
	print('YES' if CHECK else 'NO')


import sys
input = sys.stdin.readline
t = int(input())
for r in range(t):
	n = int(input())
	p = []
	c = []
	for i in range(n):
		(pi, ci) = map(int, input().split())
		p.append(pi)
		c.append(ci)
	tempp = sorted(p)
	tempc = sorted(c)
	if p == tempp and c == tempc:
		flag = True
		flag2 = True
		for i in range(n):
			if p[i] < c[i]:
				flag = False
		for i in range(n - 1):
			if abs(p[i] - p[i + 1]) < abs(c[i] - c[i + 1]):
				flag = False
		if flag == True and flag2 == True:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


T = int(input())
results = []
for case in range(1, T + 1):
	n = int(input())
	stats = []
	for i in range(n):
		(p, c) = [int(j) for j in input().split()]
		stats.append([p, c])
	result = 'YES'
	for i in range(len(stats)):
		(p, c) = stats[i]
		if p < c:
			result = 'NO'
			break
		if i < len(stats) - 1:
			(p2, c2) = stats[i + 1]
			if p2 - p < c2 - c or p2 < p or c2 < c:
				result = 'NO'
				break
	results.append(result)
for result in results:
	print(result)


t = int(input())
for tt in range(t):
	n = int(input())
	if n > 0:
		(sp, sc) = input().split()
		sp = int(sp)
		sc = int(sc)
		good = True
		if sc > sp:
			good = False
		for i in range(1, n):
			(p, c) = input().split()
			p = int(p)
			c = int(c)
			if p < c or p < sp or c < sc or (c - sc > p - sp):
				good = False
			else:
				sp = p
				sc = c
		if good:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


for u in range(int(input())):
	n = int(input())
	(l, d) = ([], [])
	ka = 1
	for i in range(n):
		(a, b) = map(int, input().split())
		l.append(a)
		d.append(b)
	if l[0] < d[0]:
		print('NO')
	else:
		for i in range(1, n):
			if l[i] >= l[i - 1] and d[i] >= d[i - 1] and (l[i] - l[i - 1] >= d[i] - d[i - 1]):
				ka = ka + 1
		if ka == n:
			print('YES')
		else:
			print('NO')


def mi():
	return map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	(p, c) = ([0] * n, [0] * n)
	for i in range(n):
		(p[i], c[i]) = mi()
	f = 1
	for i in range(n):
		if c[i] > p[i]:
			f = 0
			break
		if i >= 1 and (p[i] < p[i - 1] or c[i] < c[i - 1] or (p[i] == p[i - 1] and c[i] > c[i - 1]) or (p[i] - p[i - 1] < c[i] - c[i - 1])):
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')


def solve(n, p, c):
	pp = 0
	cc = 0
	for i in range(0, n):
		if p[i] < pp or c[i] < cc or p[i] - pp < c[i] - cc:
			return 'NO'
		pp = p[i]
		cc = c[i]
	return 'YES'
t = int(input())
for i in range(0, t):
	n = int(input())
	p = []
	c = []
	for j in range(0, n):
		(pp, cc) = input().split(' ')
		p.append(int(pp))
		c.append(int(cc))
	print(solve(n, p, c))


t = int(input())
while t > 0:
	n = int(input())
	x = []
	for i in range(n):
		l = tuple(map(int, input().split()))
		x.append(l)
	maxp = 0
	maxc = 0
	for i in range(n):
		p = x[i][0]
		c = x[i][1]
		dp = p - maxp
		dc = c - maxc
		if c > p:
			f = 0
			break
		elif maxp > p or maxc > c:
			f = 0
			break
		elif p == maxp and c > maxc:
			f = 0
			break
		elif dc > dp and dp > 0 and (dc > 0):
			f = 0
			break
		else:
			maxp = p
			maxc = c
			f = 1
	if f == 0:
		print('NO')
	elif f == 1:
		print('YES')
	t = t - 1


num = int(input())
for k in range(num):
	t = int(input())
	(pl, cl) = (0, 0)
	ans = True
	for i in range(t):
		(a, b) = map(int, input().split())
		if a - pl < 0 or b - cl < 0 or a - pl < b - cl or (pl < cl):
			ans = False
		(pl, cl) = (a, b)
	if ans:
		print('YES')
	else:
		print('NO')


import sys
ip = lambda : sys.stdin.readline().rstrip()
from collections import *
for _ in range(int(ip())):
	n = int(ip())
	(pp, pc) = (0, 0)
	ans = True
	for _ in range(n):
		(d, e) = map(int, ip().split())
		if d < pp or e < pc or d - pp < e - pc:
			ans = False
		(pp, pc) = (d, e)
	if ans:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	flag = True
	X = Y = -1
	n = int(input())
	for j in range(n):
		xy = list(map(int, input().split()))
		x = xy[0]
		y = xy[1]
		if y > x:
			flag = False
		if X > x:
			flag = False
		if Y > y:
			flag = False
		if X - Y > x - y:
			flag = False
		X = x
		Y = y
	if flag:
		print('YES')
	else:
		print('NO')


def helpPolikarp():
	isReal = True
	statList = []
	answersList = []
	T = int(input())
	for i in range(T):
		n = int(input())
		for j in range(n):
			(plays, clears) = map(int, input().split())
			statList.append([plays, clears])
			if clears > plays:
				isReal = False
		firstTries = statList[0][0]
		firstClears = statList[0][1]
		deltaC = 0
		deltaP = 0
		for z in statList:
			deltaP = z[0] - firstTries
			deltaC = z[1] - firstClears
			if z[0] > firstTries:
				firstTries = z[0]
			if z[1] > firstClears:
				firstClears = z[1]
			if z[0] < firstTries or z[1] < firstClears or deltaC > deltaP:
				isReal = False
		statList.clear()
		answersList.append('YES' if isReal else 'NO')
		isReal = True
	for answer in answersList:
		print(answer)
helpPolikarp()


def poly():
	tab = []
	n = 0
	boo = 0
	for i in range(int(input())):
		tab = []
		n = int(input())
		boo = 0
		tab.append(input().split(' '))
		if int(tab[0][0]) < int(tab[0][1]):
			boo = 1
		for j in range(n - 1):
			tab.append(input().split(' '))
			if int(tab[1][0]) - int(tab[0][0]) < int(tab[1][1]) - int(tab[0][1]):
				boo = 1
			if int(tab[1][0]) < int(tab[0][0]):
				boo = 1
			if int(tab[1][1]) < int(tab[0][1]):
				boo = 1
			tab.pop(0)
		if boo == 0:
			print('YES')
		else:
			print('NO')
poly()


T = int(input())
for x in range(T):
	N = int(input())
	p = []
	c = []
	correct = True
	for i in range(N):
		(pi, ci) = map(int, input().split())
		p.append(pi)
		c.append(ci)
		if i > 0:
			if pi < p[i - 1] or ci < c[i - 1]:
				correct = False
			elif ci - c[i - 1] > pi - p[i - 1]:
				correct = False
		elif ci > pi or ci < 0 or pi < 0:
			correct = False
	if correct:
		print('YES')
	else:
		print('NO')