Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.
Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.
It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.
Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.
Can Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N \leq 2 \times 10^5
 - 1 \leq A_i, B_i \leq 10^9 (1 \leq i \leq N)

-----Input-----
Input is given from Standard Input in the following format:
N
A_1 B_1
.
.
.
A_N B_N

-----Output-----
If Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.

-----Sample Input-----
5
2 4
1 9
1 8
4 9
3 12

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

He can complete all the jobs in time by, for example, doing them in the following order:
 - Do Job 2 from time 0 to 1.
 - Do Job 1 from time 1 to 3.
 - Do Job 4 from time 3 to 7.
 - Do Job 3 from time 7 to 8.
 - Do Job 5 from time 8 to 11.
Note that it is fine to complete Job 3 exactly at the deadline, time 8.

Difficulty: MEDIUM

Solutions:
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
AB = sorted(AB, key=lambda x: x[1])
t = 0
for i in range(N):
	t += AB[i][0]
	if t > AB[i][1]:
		print('No')
		exit()
print('Yes')


c = 0
D = 1
for (b, a) in sorted([tuple(map(int, input().split()))[::-1] for _ in range(int(input()))]):
	c += a
	if b < c:
		D = 0
print('Yes' if D else 'No')


N = int(input())
tasks = sorted((tuple(map(int, input().split())) for _ in range(N)), key=lambda x: x[1])
tmp = 0
for (c, t) in tasks:
	tmp += c
	if tmp > t:
		print('No')
		exit()
print('Yes')


n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
a.sort(key=lambda x: x[1])
t = 0
for (i, j) in a:
	t += i
	if t > j:
		print('No')
		break
else:
	print('Yes')


N = int(input())
BA = []
for _ in range(N):
	(a, b) = map(int, input().split())
	BA.append((b, a))
BA.sort()
t = 0
for (b, a) in BA:
	t += a
	if t > b:
		print('No')
		exit()
print('Yes')


n = int(input())
jobs = [tuple(map(int, input().split())) for _ in range(n)]
jobs.sort(key=lambda x: x[1])
t = 0
for (a, b) in jobs:
	t += a
	if t > b:
		print('No')
		exit()
print('Yes')


n = int(input())
task = [tuple(map(int, input().split())) for _ in range(n)]
task = sorted(task, key=lambda x: x[1])
t = 0
for i in range(n):
	t += task[i][0]
	if t > task[i][1]:
		print('No')
		exit()
print('Yes')


n = int(input())
ab = [[int(_) for _ in input().split()] for _ in range(n)]
ab.sort(key=lambda x: x[1])
t = 0
for v in ab:
	t += v[0]
	if t > v[1]:
		print('No')
		exit()
print('Yes')


n = int(input())
L = [list(map(int, input().split())) for i in range(n)]
L.sort(key=lambda x: x[1])
t = 0
for (a, b) in L:
	t += a
	if t > b:
		print('No')
		exit()
print('Yes')


N = int(input())
list = [list(map(int, input().split())) for _ in range(N)]
list.sort(key=lambda x: x[1])
sum_ = 0
for (a, b) in list:
	sum_ += a
	if sum_ > b:
		print('No')
		exit()
print('Yes')


n = int(input())
ab = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: x[1])
t = 0
for (a, b) in ab:
	t += a
	if t > b:
		print('No')
		exit()
print('Yes')


n = int(input())
ab = []
now = 0
for i in range(n):
	(_a, _b) = map(int, input().split())
	ab.append([_a, _b])
ab.sort(key=lambda x: x[1])
for (a, b) in ab:
	now += a
	if now > b:
		print('No')
		return
print('Yes')


import sys
n = int(input())
work = [list(map(int, input().split())) for i in range(n)]
work = sorted(work, key=lambda x: x[1])
sum = 0
for i in range(n):
	sum += work[i][0]
	if sum > work[i][1]:
		print('No')
		return
print('Yes')


N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
sortAB = sorted(AB, key=lambda x: x[1])
t = 0
for (a, b) in sortAB:
	t += a
	if t > b:
		print('No')
		break
else:
	print('Yes')


import operator
N = int(input())
work = sorted([tuple(map(int, input().split())) for _ in range(N)], key=operator.itemgetter(1), reverse=True)
t = work[0][1]
for i in range(N):
	if t > work[i][1]:
		t = work[i][1]
	t -= work[i][0]
print(['No', 'Yes'][t >= 0])


N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
time = 0
for (a, b) in AB:
	time += a
	if time > b:
		print('No')
		return
print('Yes')


N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
ans = 'Yes'
n = 0
for (a, b) in AB:
	n += a
	if n > b:
		ans = 'No'
		break
print(ans)


n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
c = 0
l.sort(key=lambda x: x[1])
for i in range(n):
	c += l[i][0]
	if c > l[i][1]:
		print('No')
		exit()
print('Yes')


n = int(input())
li = [list(map(int, input().split())) for i in range(n)]
li.sort(key=lambda x: x[1])
time = 0
flag = 'Yes'
for i in li:
	time += i[0]
	if i[1] < time:
		flag = 'No'
		break
print(flag)


(n, t) = (int(input()), 0)
AB = [list(map(int, input().split())) for _ in range(n)]
AB.sort(key=lambda X: X[1])
for ab in AB:
	t += ab[0]
	if t > ab[1]:
		print('No')
		return
print('Yes')


n = int(input())
work = []
for i in range(n):
	(a, b) = list(map(int, input().split()))
	work.append((a, b))
work = sorted(work, key=lambda x: (x[1], x[0]))
t = 0
for (time, limit) in work:
	t += time
	if t > limit:
		print('No')
		return
print('Yes')


N = int(input())
AB = []
for _ in range(N):
	AB.append(tuple(map(int, input().split())))
AB.sort(key=lambda x: x[1])
T = 0
R = 'Yes'
for (a, b) in AB:
	T += a
	if T > b:
		R = 'No'
print(R)


n = int(input())
l = [list(map(int, input().split()))[::-1] for _ in range(n)]
l.sort()
t = 0
ans = 'Yes'
for m in l:
	t += m[1]
	if t > m[0]:
		ans = 'No'
print(ans)


n = int(input())
d = []
for _ in range(n):
	(a, b) = map(int, input().split())
	d += [(b, a)]
d = sorted(d)
t = 0
for (i, j) in d:
	if j + t > i:
		print('No')
		break
	t += j
else:
	print('Yes')


import sys
inint = lambda : int(sys.stdin.readline())
inintm = lambda : map(int, sys.stdin.readline().split())
inintl = lambda : list(inintm())
instrm = lambda : map(str, sys.stdin.readline().split())
instrl = lambda : list(instrm())
n = inint()
wt = []
for i in range(n):
	(a, b) = inintm()
	wt.append([a, b])
wt = sorted(wt, reverse=True, key=lambda x: x[1])[::-1]
t = 0
for j in range(n):
	t += wt[j][0]
	if t > wt[j][1]:
		print('No')
		return
print('Yes')


def main():
	N = int(input())
	tasks = []
	for i in range(N):
		(A, B) = [int(x) for x in input().split(' ')]
		tasks.append({'time': A, 'deadline': B})
	tasks.sort(key=lambda task: task['deadline'])
	tot = 0
	in_time = 'Yes'
	for i in range(len(tasks)):
		t = tasks[i]['time']
		d = tasks[i]['deadline']
		tot += t
		if tot > d:
			in_time = 'No'
			break
	print(in_time)
main()


n = int(input())
t = 0
ab = [list(map(int, input().split())) for i in range(n)]
abt = sorted(ab, key=lambda x: x[1])
for i in range(n):
	t += abt[i][0]
	if t > abt[i][1]:
		print('No')
		return
print('Yes')


import os
import sys

def main():
	n = int(input())
	S = []
	for _ in range(n):
		S.append(list(map(int, input().split())))
	S.sort(key=lambda x: x[1])
	current_time = 0
	for s in S:
		current_time += s[0]
		if current_time <= s[1]:
			pass
		else:
			print('No')
			return
	print('Yes')

def __starting_point():
	main()
__starting_point()


N = int(input())
AB = [tuple(map(int, input().split())) for i in range(N)]
AB.sort(key=lambda x: x[1])
t = 0
for (a, b) in AB:
	t += a
	if t > b:
		print('No')
		exit()
print('Yes')


N = int(input())
AB = [list(map(int, input().split())) for i in range(N)]
AB.sort(key=lambda x: x[1])
total = 0
for i in range(N):
	total += AB[i][0]
	if total <= AB[i][1]:
		continue
	else:
		print('No')
		return
print('Yes')


n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
time = 0
for i in range(n):
	time += ab[i][0]
	if time > ab[i][1]:
		print('No')
		break
else:
	print('Yes')


n = int(input())
a = [list(map(int, input().split()))[::-1] for _ in range(n)]
a.sort()
t = 0
for (i, j) in a:
	t += j
	if i < t:
		print('No')
		exit()
print('Yes')


(n, *t) = map(int, open(0).read().split())
c = f = 0
for (b, a) in sorted(zip(t[1::2], t[::2])):
	c += a
	f |= c > b
print('YNeos'[f::2])


N = int(input())
a = list()
for _ in range(N):
	(A, B) = list(map(int, input().split()))
	a.append((B, A))
a.sort()
t = 0
for i in range(N):
	t += a[i][1]
	if t > a[i][0]:
		print('No')
		return
print('Yes')


N = int(input())
l = [[int(j) for j in input().split()] for i in range(N)]
l = sorted(l, key=lambda x: x[1])
s = 0
ans = 'Yes'
for (a, b) in l:
	s += a
	if s > b:
		ans = 'No'
		break
print(ans)


n = int(input())
t = 0
for (d, s) in sorted((list(map(int, input().split()))[::-1] for _ in range(n))):
	t += s
	if t > d:
		print('No')
		exit()
print('Yes')


N = int(input())
work = []
for _ in range(N):
	(a, b) = map(int, input().split())
	work.append((a, b))
work = sorted(work, key=lambda x: x[1], reverse=False)
result = 'Yes'
t = 0
for (i, j) in work:
	t += i
	if t > j:
		result = 'No'
		break
print(result)


def main():
	point = 0
	ab = []
	for i in range(int(input())):
		t = list(map(int, input().split()))
		ab.append(t)
	ab.sort(key=lambda x: x[1])
	for i in range(len(ab)):
		point += ab[i][0]
		if point > ab[i][1]:
			print('No')
			return
	print('Yes')

def __starting_point():
	main()
__starting_point()


N = int(input())
A = [list(map(int, input().split())) for i in range(N)]
A = sorted(A, key=lambda x: x[1])
work = 0
for a in A:
	work += a[0]
	if work > a[1]:
		print('No')
		exit()
print('Yes')


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

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

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

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

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

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

def s_input():
	return input()

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

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

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

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

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

def main():
	n = i_input()
	l = [i_list() for i in range(n)]
	l = sorted(l, key=lambda x: x[1])
	trial = 0
	for (i, k) in l:
		trial += i
		if trial > k:
			print('No')
			return
	print('Yes')

def __starting_point():
	main()
__starting_point()


N = int(input())
L = [list(map(int, input().split())) for _ in range(N)]
L = sorted(L, key=lambda x: x[1])
t = 0
for l in L:
	t += l[0]
	if t > l[1]:
		print('No')
		exit(0)
print('Yes')


N = int(input())
P = [0] * N
for i in range(N):
	P[i] = list(map(int, input().split()))
P.sort(key=lambda x: x[1])
t = 0
ans = 'Yes'
for p in P:
	t += p[0]
	if t > p[1]:
		ans = 'No'
print(ans)


n = int(input())
l = []
for i in range(n):
	(a, b) = map(int, input().split())
	l.append([b, a])
l.sort()
tmp = 0
for i in range(n):
	tmp += l[i][1]
	if tmp > l[i][0]:
		print('No')
		break
	if i == n - 1:
		print('Yes')


N = int(input())
L = [list(map(int, input().split())) for _ in range(N)]
L.sort(key=lambda x: x[1])
w = 0
for (x, y) in L:
	w += x
	if w > y:
		print('No')
		exit()
print('Yes')


n = int(input())
task = [[int(i) for i in input().split()] for _ in range(n)]
task.sort(key=lambda x: x[1])
t = 0
for i in task:
	t += i[0]
	if t > i[1]:
		exit(print('No'))
print('Yes')


N = int(input())
L = [list(map(int, input().split())) for _ in range(N)]
L.sort(key=lambda x: x[1])
t = 0
p = True
for l in L:
	t += l[0]
	if t > l[1]:
		p = False
		break
print('Yes' if p else 'No')


def main():
	N = int(input())
	A = []
	for _ in range(N):
		(a, b) = map(int, input().split())
		A.append(tuple([b, a]))
	A.sort()
	total = 0
	for (a, b) in A:
		total += b
		if a < total:
			print('No')
			return
	print('Yes')
main()


import sys
N = int(input())
jobs = []
for _ in range(N):
	(a, b) = map(int, input().split())
	jobs.append([a, b])
jobs.sort(key=lambda x: x[1])
time = 0
for i in range(N):
	time += jobs[i][0]
	if time > jobs[i][1]:
		print('No')
		return
print('Yes')


A = sorted([tuple(map(int, input().split())) for _ in range(int(input()))], key=lambda x: x[1])
c = 0
D = []
for (a, b) in A:
	c += a
	D.append(c <= b)
print('Yes' if all(D) else 'No')


from operator import itemgetter
n = int(input())
l = []
for i in range(n):
	(a, b) = map(int, input().split())
	l.append([a, b])
l = sorted(l, key=itemgetter(1))
tmp = 0
f = 1
for (i, j) in l:
	tmp += i
	if tmp > j:
		f = 0

def Y(a, t=0):
	if a == t:
		print('YES')
	else:
		print('NO')

def y(a, t=0):
	if a == t:
		print('Yes')
	else:
		print('No')
y(f, 1)


N = int(input())
P = []
for i in range(N):
	(a, b) = map(int, input().split())
	P.append([b, a])
P = sorted(P)
time = 0
for i in range(N):
	time += P[i][1]
	if time > P[i][0]:
		print('No')
		return
print('Yes')


import numpy as np
N = int(input())
A_list = [0] * N
B_list = [0] * N
for i in range(N):
	(A_list[i], B_list[i]) = list(map(int, input().split()))
x = np.argsort(B_list)
A_list = np.array(A_list)[x]
B_list = np.array(B_list)[x]
ans = 0
for (i, j) in zip(A_list, B_list):
	ans += i
	if ans <= j:
		pass
	else:
		print('No')
		return
print('Yes')


N = int(input())
ab = []
for i in range(N):
	ab.append(list(map(int, input().split())))
ab.sort(key=lambda x: x[1])
t = 0
for i in ab:
	t += i[0]
	if t > i[1]:
		print('No')
		exit()
print('Yes')


N = int(input())
t = [0] * N
for i in range(N):
	t[i] = list(map(int, input().split()))
t = sorted(t, key=lambda x: x[1])
n = 0
d = 0
f = 0
for i in range(N):
	n += t[i][0]
	if n > t[i][1]:
		f = 1
		break
if f == 0:
	print('Yes')
else:
	print('No')


N = int(input())
AB = []
for i in range(N):
	(a, b) = list(map(int, input().strip().split(' ')))
	AB += [[b, a]]
AB.sort()
tim = 0
for i in range(N):
	tim += AB[i][1]
	if tim > AB[i][0]:
		print('No')
		exit()
print('Yes')


N = int(input())
AB = [list(map(int, input().split())) for i in range(N)]
AB.sort(key=lambda x: x[1])
time = 0
for (A, B) in AB:
	time += A
	if time > B:
		print('No')
		break
else:
	print('Yes')


N = int(input())
AB = sorted([list(map(int, input().split())) for i in range(N)], key=lambda x: x[1])
x = 0
ans = 1
for (a, b) in AB:
	x += a
	if x > b:
		ans = 0
		break
print(['No', 'Yes'][ans])


import sys
n = int(input())
t = 0
for (s, d) in sorted([list(map(int, sys.stdin.readline().split())) for _ in range(n)], key=lambda k: k[1]):
	t += s
	if t > d:
		print('No')
		break
else:
	print('Yes')


(N, *AB) = list(map(int, open(0).read().split()))
AB_sorted = sorted(zip(AB[0::2], AB[1::2]), key=lambda x: x[1])
current = 0
for (a, b) in AB_sorted:
	current += a
	if current > b:
		print('No')
		return
print('Yes')


N = int(input())
A = []
for i in range(N):
	A.append(list(map(int, input().split())))
A.sort(key=lambda x: x[1])
n = 0
ans = 'Yes'
for a in A:
	n += a[0]
	if n > a[1]:
		ans = 'No'
print(ans)


n = int(input())
arr = []
for i in range(n):
	(a, b) = map(int, input().split())
	arr.append([b, a])
arr.sort()
now = 0
for a in arr:
	if now + a[1] > a[0]:
		print('No')
		exit()
	now += a[1]
print('Yes')


import numpy as np
N = int(input())
AB = [''] * N
for i in range(N):
	AB[i] = list(map(int, input().split()))
AB = sorted(AB, key=lambda x: x[1])
total = 0
flag = 1
for i in range(N):
	total += AB[i][0]
	if total > AB[i][1]:
		flag = 0
		break
if flag == 1:
	print('Yes')
else:
	print('No')


N = int(input())
l = []
for _ in range(N):
	ab = list(map(int, input().split()))
	l.append(ab)
l.sort(key=lambda x: x[1])
time = 0
flag = True
for i in range(N):
	time += l[i][0]
	if time > l[i][1]:
		flag = False
		break
if flag == True:
	print('Yes')
else:
	print('No')


import numpy as np
n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
flag = True
sum = 0
sorted_index = np.argsort(b)
for i in sorted_index:
	sum += a[i]
	if sum > b[i]:
		flag = False
		break
if flag:
	print('Yes')
else:
	print('No')


n = int(input())
a = [[int(i) for i in input().split()] for _ in range(n)]
a = sorted(a, reverse=True, key=lambda x: x[1])
t = a[0][1]
for x in a:
	t = min(x[1], t) - x[0]
print('Yes' if t >= 0 else 'No')


N = int(input())
BA = []
for i in range(N):
	(A, B) = map(int, input().split())
	BA.append([B, A])
BA.sort()
check = True
sum_A = 0
for j in range(N):
	sum_A += BA[j][1]
	if sum_A > BA[j][0]:
		check = False
		break
print('Yes' if check else 'No')


n = int(input())
ab = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda i: i[1])
t = 0
for i in ab:
	t += i[0]
	if t > i[1]:
		print('No')
		exit()
print('Yes')


n = int(input())
a = list((list(map(int, input().split())) for _ in range(n)))
a.sort(key=lambda x: x[1])
ans = 0
for i in a:
	ans += i[0]
	if ans > i[1]:
		print('No')
		exit()
print('Yes')


N = int(input())
AB = [[int(i) for i in input().split()] for j in range(N)]
AB.sort(key=lambda x: x[1])
time = 0
for (i, j) in AB:
	time += i
	if time > j:
		print('No')
		exit()
print('Yes')


N = int(input())
lis = sorted([list(map(int, input().split()))[::-1] for _ in range(N)])
time = 0
flag = 1
for (d, t) in lis:
	time += t
	if time > d:
		flag = 0
print(['No', 'Yes'][flag])


n = int(input())
l = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x: x[1])
t = 0
for (a, b) in l:
	t += a
	if t > b:
		print('No')
		break
else:
	print('Yes')


N = int(input())
A_B = [[int(i) for i in input().split()] for _ in range(N)]
A_B.sort(key=lambda x: x[1])
time = 0
for i in A_B:
	time += i[0]
	if time > i[1]:
		print('No')
		exit()
print('Yes')


n = int(input())
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort(key=lambda x: x[1])
(t, s) = (0, 0)
for (a, b) in ab:
	t = b
	s += a
	if s <= t:
		pass
	else:
		print('No')
		exit(0)
print('Yes')


N = int(input())
li_ = []
for i in range(N):
	(A, B) = map(int, input().split())
	li_.append((B, A))
li_.sort()
time = 0
for i in range(N):
	time += li_[i][1]
	if time > li_[i][0]:
		print('No')
		exit()
print('Yes')


n = int(input())
w = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x: x[1])
agg = 0
for (c, t) in w:
	agg += c
	if t < agg:
		print('No')
		exit()
print('Yes')


n = int(input())
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort(key=lambda x: x[1])
s = 0
for i in ab:
	s += i[0]
	if s > i[1]:
		print('No')
		exit()
print('Yes')


def main():
	n = int(input())
	adic = dict()
	bdic = dict()
	for i in range(n):
		(a, b) = map(int, input().split())
		adic[i + 1] = a
		bdic[i + 1] = b
	bdic2 = sorted(bdic.items(), key=lambda x: x[1])
	time = 0
	for dic in bdic2:
		shigoto = dic[0]
		time += adic[shigoto]
		if time > dic[1]:
			print('No')
			return
	print('Yes')

def __starting_point():
	main()
__starting_point()


import itertools
n = int(input())
work_lst = []
for _ in range(n):
	(a, b) = map(int, input().split())
	work_lst.append((a, b))
work_lst.sort(key=lambda x: x[1])
work_acc = [i[0] for i in work_lst]
work_acc = itertools.accumulate(work_acc)
work_dead = [i[1] for i in work_lst]
for (x, dead) in zip(work_acc, work_dead):
	if x > dead:
		print('No')
		break
else:
	print('Yes')


import sys
input = sys.stdin.readline

def main():
	N = int(input())
	T = [list(map(int, input().split())) for i in range(N)]
	S = [[b, a] for (a, b) in T]
	U = sorted(S)
	time = 0
	for (b, a) in U:
		time += a
		if time > b:
			print('No')
			return
	print('Yes')

def __starting_point():
	main()
__starting_point()


N = int(input())
W = [list(map(int, input().split())) for i in range(N)]
W = sorted(W, key=lambda x: x[1])
t = 0
for (a, b) in W:
	t += a
	if t > b:
		print('No')
		break
else:
	print('Yes')


s = sorted([list(map(int, input().split())) for i in range(int(input()))], key=lambda x: x[1])
d = 0
for i in s:
	if d + i[0] > i[1]:
		print('No')
		break
	else:
		d += i[0]
else:
	print('Yes')


n = int(input())
ab = [[int(x) for x in input().split()] for j in range(n)]
ab.sort(key=lambda x: (x[1], x[0]))
c = 0
for i in range(n):
	c += ab[i][0]
	if c > ab[i][1]:
		print('No')
		exit()
print('Yes')


N = int(input())
BA = []
for _ in range(N):
	(A, B) = list(map(int, input().split()))
	BA.append([B, A])
BA.sort()
T = 0
for i in range(N):
	T += BA[i][1]
	if T > BA[i][0]:
		print('No')
		break
else:
	print('Yes')


N = int(input())
A = [list(map(int, input().split())) for i in range(N)]
B = sorted(A, key=lambda x: x[1])
T = 0
for i in range(N):
	T += B[i][0]
	if T > B[i][1]:
		print('No')
		exit()
print('Yes')


n = int(input())
x = [[0, 0]]
for _ in range(n):
	(a, b) = map(int, input().split())
	x.append([b, a])
x.sort()
for i in range(1, n + 1):
	x[i][1] += x[i - 1][1]
	if x[i][0] < x[i][1]:
		print('No')
		return
print('Yes')


import numpy
N = int(input())
task = numpy.array([list(map(int, input().split())) for _ in range(N)])
task = task[numpy.argsort(task[:, 1])]
ans = 'Yes'
time = 0
for j in task:
	time += j[0]
	if time > j[1]:
		ans = 'No'
		break
print(ans)


N = int(input())
X = [[int(_) for _ in input().split()] for _ in range(N)]
X.sort(key=lambda x: x[1])
t = 0
for (a, b) in X:
	t += a
	if t > b:
		print('No')
		exit(0)
print('Yes')


N = int(input())
K = [list(map(int, input().split())) for _ in range(N)]
K.sort(key=lambda x: x[1])
M = 0
for (k, v) in K:
	M += k
	if M > v:
		print('No')
		exit()
print('Yes')


n = int(input())
d = []
for _ in range(n):
	(a, b) = map(int, input().split())
	d.append([a, b])
l = sorted(d, key=lambda x: x[1])
z = 'Yes'
s = 0
for i in range(n):
	s += l[i][0]
	if s > l[i][1]:
		z = 'No'
		break
print(z)


N = int(input())
AB = sorted([list(map(int, input().split())) for _ in [0] * N], key=lambda x: x[1])
T = 0
for (A, B) in AB:
	T += A
	if T > B:
		print('No')
		break
else:
	print('Yes')


N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: (x[1], x[0]))
s = 0
ans = 'Yes'
for (A, B) in AB:
	s += A
	if s > B:
		ans = 'No'
		break
print(ans)


N = int(input())
W = []
for _ in range(N):
	(a, b) = map(int, input().split())
	W.append([a, b])
s = 0
for (a, b) in sorted(W, key=lambda x: x[1]):
	s += a
	if s > b:
		print('No')
		quit()
print('Yes')


n = int(input())
m = []
for _ in range(n):
	m += [list(map(int, input().split()))]
m.sort(key=lambda x: x[1])
t = 0
ans = 1
for i in range(n):
	t += m[i][0]
	if t > m[i][1]:
		ans = 0
		break
print('YNeos'[1 - ans::2])


n = int(input())
AB = sorted([list(map(int, input().split())) for i in range(n)], key=lambda x: x[1])
tmp = 0
for (a, b) in AB:
	if tmp + a <= b:
		pass
	else:
		print('No')
		exit()
	tmp += a
print('Yes')


n = int(input())
ab = []
for i in range(n):
	ab.append(tuple(map(int, input().split())))
ab.sort(key=lambda x: x[1])
m = 0
ans = 'Yes'
for (ai, bi) in ab:
	m += ai
	if m > bi:
		ans = 'No'
print(ans)


N = int(input())
W = []
for _ in range(N):
	(a, b) = map(int, input().split())
	W.append((a, b))
W.sort(key=lambda x: x[1])
cur = 0
for (a, b) in W:
	if cur + a > b:
		print('No')
		exit()
	cur += a
print('Yes')


N = int(input())
ts = [tuple(map(int, input().split())) for _ in range(N)]
ts.sort(key=lambda t: t[1])
T = 0
for (a, b) in ts:
	T += a
	if T > b:
		print('No')
		exit(0)
print('Yes')


t = 0
for (i, j) in sorted([list(map(int, input().split())) for _ in [0] * int(input())], key=lambda x: x[1]):
	t += i
	if t > j:
		print('No')
		exit()
print('Yes')


N = int(input())
inputs = [tuple(map(int, input().split(' '))) for i in range(N)]
inputs = sorted(inputs, key=lambda x: x[1])
time = 0
for (ai, bi) in inputs:
	time += ai
	if time > bi:
		print('No')
		break
if time <= bi:
	print('Yes')


N = int(input())
C = [tuple(map(int, input().split())) for _ in range(N)]
C.sort(key=lambda x: x[1])
x = 0
ans = 'Yes'
for (a, b) in C:
	x += a
	if x > b:
		ans = 'No'
print(ans)


n = int(input())
(a, f, b) = (sorted([list(map(int, input().split())) for i in range(n)], key=lambda x: x[1]), 1, 0)
for i in range(n):
	b += a[i][0]
	if b > a[i][1]:
		f = 0
print('Yes' if f == 1 else 'No')


n = int(input())
x = [list(map(int, input().split())) for i in range(n)]
y = []
y = sorted(x, key=lambda x: x[1])
a = 0
for i in y:
	a += i[0]
	if a > i[1]:
		print('No')
		return
print('Yes')


n = int(input())
works = sorted([list(map(int, input().split()))[::-1] for i in range(n)])
time = 0
ans = 'Yes'
for i in range(n):
	time += works[i][1]
	if time > works[i][0]:
		ans = 'No'
print(ans)


N = int(input())
arr = [list(map(int, input().split())) for _ in range(N)]
arr.sort(key=lambda x: x[1])
cnt = 0
for (a, b) in arr:
	cnt += a
	if cnt > b:
		flag = 'No'
		break
	flag = 'Yes'
print(flag)


N = int(input())
A = [[int(i) for i in input().split()] for _ in range(N)]
A = sorted(A, key=lambda x: x[1])
total = 0
ret = 'Yes'
for i in A:
	total += i[0]
	if total > i[1]:
		ret = 'No'
		break
print(ret)


N = int(input())
AB = [list(map(int, input().split())) for i in range(N)]
AB.sort(key=lambda x: (x[1], x[0]))
s = 0
for t in AB:
	s += t[0]
	if s > t[1]:
		print('No')
		quit()
print('Yes')


n = int(input())
ba = []
for i in range(n):
	(a, b) = map(int, input().split())
	ba.append([b, a])
ba.sort()
t = 0
for i in range(n):
	t += ba[i][1]
	if t <= ba[i][0]:
		continue
	else:
		print('No')
		return
print('Yes')


n = int(input())
W = []
for _ in range(n):
	(a, b) = map(int, input().split())
	W.append((b, a))
W.sort()
t = 0
for w in W:
	t += w[1]
	if t > w[0]:
		print('No')
		exit()
print('Yes')


n = int(input())
ab = [tuple(map(int, input().split())) for _ in range(n)]
ab = sorted(ab, key=lambda x: x[1])
ans = 0
for (i, j) in ab:
	ans += i
	if ans > j:
		print('No')
		exit()
print('Yes')


n = int(input())
work = [list(map(int, input().split())) for _ in range(n)]
work = sorted(work, key=lambda x: x[1])
a = [0] * n
a[0] = work[0][0]
for i in range(1, n):
	a[i] = a[i - 1] + work[i][0]
ans = 'Yes'
for j in range(n):
	if a[j] > work[j][1]:
		ans = 'No'
		break
print(ans)


n = int(input())
A = []
for i in range(n):
	(a, b) = map(int, input().split())
	A.append((b, a))
A.sort()
c = 0
for a in A:
	c += a[1]
	if c > a[0]:
		print('No')
		exit()
print('Yes')


N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
timeSum = 0
for i in AB:
	timeSum += i[0]
	if timeSum > i[1]:
		print('No')
		exit()
print('Yes')


N = int(input())
A = [list(map(int, input().split())) for i in range(N)]
A.sort(key=lambda x: x[1])
su = 0
for i in A:
	su += i[0]
	if su > i[1]:
		print('No')
		exit()
print('Yes')


from operator import itemgetter
n = int(input())
ab = [list(map(int, input().split())) for i in range(n)]
ab = sorted(ab, key=itemgetter(1))
for i in range(n):
	if ab[i][0] > ab[i][1]:
		print('No')
		return
	if i != n - 1:
		ab[i + 1][0] += ab[i][0]
	else:
		print('Yes')


n = int(input())
lst = []
for i in range(n):
	a = list(map(int, input().split()))
	lst.append(a)
lst.sort(key=lambda x: x[1])
time = 0
for i in lst:
	time += i[0]
	if time > i[1]:
		print('No')
		return
print('Yes')


n = int(input())
x = []
for i in range(n):
	(a, b) = map(int, input().split())
	x.append([b, a])
x = sorted(x)
t = 0
for j in range(n):
	t += x[j][1]
	if t > x[j][0]:
		print('No')
		exit()
print('Yes')


from operator import *
N = int(input())
AB = [list(map(int, input().split())) for n in range(N)]
AB = sorted(AB, key=itemgetter(1))
ans = 'Yes'
T = 0
for (a, b) in AB:
	T += a
	if b < T:
		ans = 'No'
print(ans)


import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

def I():
	return int(input())

def F():
	return float(input())

def SS():
	return input()

def LI():
	return [int(x) for x in input().split()]

def LI_():
	return [int(x) - 1 for x in input().split()]

def LF():
	return [float(x) for x in input().split()]

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

def resolve():
	N = I()
	AB = [LI() for _ in range(N)]
	AB.sort(key=lambda x: x[1])
	ans = 'Yes'
	t = 0
	limit = 0
	for (A, B) in AB:
		limit = B
		t += A
		if t > limit:
			ans = 'No'
			break
	print(ans)

def __starting_point():
	resolve()
__starting_point()


N = int(input())
tasks = []
time = 0
ans = 'Yes'
for _ in range(N):
	(A, B) = map(int, input().split())
	tasks.append((B, A))
tasks.sort()
for (b, a) in tasks:
	time += a
	if b < time:
		ans = 'No'
		break
print(ans)


n = int(input())
works = {}
for _ in range(n):
	(a, b) = list(map(int, input().split()))
	if b not in works:
		works.setdefault(b, [a])
	else:
		works[b].append(a)
works = sorted(list(works.items()), key=lambda x: x[0])
total = 0
for (key, value) in works:
	total += sum(value)
	if total > key:
		print('No')
		break
else:
	print('Yes')


n = int(input())
AB = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: x[1])
t = 0
flag = False
for (a, b) in AB:
	t += a
	if t > b:
		flag = True
print('No' if flag else 'Yes')


N = int(input())
A = [tuple(map(int, input().split())) for _ in range(N)]
A.sort(key=lambda x: x[1])
count = 0
for (a, b) in A:
	count += a
	if count > b:
		print('No')
		exit()
print('Yes')


N = int(input())
ba = [list(map(int, input().split()))[::-1] for _ in range(N)]
ba.sort()
time = 0
ans = 'Yes'
for (b, a) in ba:
	time += a
	if time > b:
		ans = 'No'
print(ans)


import sys
input = sys.stdin.readline
al = [list(map(int, input().split())) for _ in range(int(input()))]
al = sorted(al, key=lambda x: x[1])
s = 0
for (i, j) in al:
	s += i
	if s > j:
		print('No')
		break
else:
	print('Yes')


def __starting_point():
	N = int(input())
	tasks = []
	for _ in range(N):
		(a, b) = list(map(int, input().split()))
		tasks.append((b, a))
	tasks.sort()
	t = 0
	for (b, a) in tasks:
		if t + a > b:
			break
		t += a
	else:
		print('Yes')
		return
	print('No')
__starting_point()


n = int(input())
times = [list(map(int, input().split())) for _ in range(n)]
time = 0
for i in sorted(times, key=lambda x: x[1]):
	time += i[0]
	if time > i[1]:
		print('No')
		exit()
print('Yes')


l = int(input())
a = []
for i in range(l):
	(m, n) = (int(i) for i in input().split())
	a.append([n, m])
a.sort()
r = 'Yes'
s = 0
for i in range(l):
	s = s + a[i][1]
	if s > a[i][0]:
		r = 'No'
		break
print(r)


n = int(input())
l = [0] * n
for i in range(n):
	l[i] = list(map(int, input().split()))
l.sort(key=lambda x: x[1])
cnt = 0
for i in range(n):
	cnt += l[i][0]
	if cnt > l[i][1]:
		print('No')
		return
print('Yes')


n = int(input())
li = [list(map(int, input().split())) for _ in range(n)]
li.sort(key=lambda x: x[1])
time = 0
for (i, j) in li:
	time += i
	if time > j:
		print('No')
		exit()
print('Yes')


n = int(input())
b = []
for i in range(n):
	(x, y) = map(int, input().split())
	b.append([y, x])
b.sort()
ans = 'Yes'
t = 0
for i in range(n):
	t += b[i][1]
	if t > b[i][0]:
		ans = 'No'
print(ans)


N = int(input())
T = []
for i in range(N):
	T.append(tuple(map(int, input().split())))
T = sorted(T, key=lambda x: x[1])
t = 0
for (a, b) in T:
	t += a
	if t > b:
		print('No')
		quit()
print('Yes')


n = int(input())
t = []
for i in range(n):
	(a, b) = map(int, input().split())
	t.append([b, a])
t.sort()
p = 0
ans = 'Yes'
for i in range(n):
	p += t[i][1]
	if p > t[i][0]:
		ans = 'No'
		break
print(ans)


n = int(input())
t = []
for i in range(n):
	(at, bt) = map(int, input().split())
	t.append([bt, at])
t.sort()
temp = 0
for i in range(n):
	temp = temp + t[i][1]
	if temp > t[i][0]:
		print('No')
		break
else:
	print('Yes')


N = int(input())
X = [tuple(map(int, input().split())) for _ in range(N)]
X.sort(key=lambda x: x[1])
t = 0
for (a, b) in X:
	t += a
	if t > b:
		print('No')
		break
else:
	print('Yes')


n = int(input())
ab = sorted([list(map(int, input().split())) for i in range(n)], key=lambda x: x[1])
now = cant = 0
for (a, b) in ab:
	now += a
	if now > b:
		cant = True
print('YNeos'[cant::2])


n = int(input())
jobs = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: x[1])
t = 0
for job in jobs:
	t += job[0]
	if t > job[1]:
		print('No')
		break
else:
	print('Yes')


n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
l = sorted(l, key=lambda x: x[1])
time = 0
for (a, b) in l:
	time += a
	if time > b:
		print('No')
		exit()
print('Yes')


N = int(input())
t = 0
AB = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda val: val[1])
for (A, B) in AB:
	t += A
	if t > B:
		print('No')
		exit()
print('Yes')


import pprint
n = int(input())
a = [[0] * 2 for i in range(n)]
memo = 0
ahozon = 0
for i in range(n):
	(a[i][0], a[i][1]) = map(int, input().split())
a.sort(key=lambda x: x[1])
for j in range(n):
	if memo <= 1:
		if a[j][1] - a[j][0] - ahozon >= 0:
			ahozon += a[j][0]
		else:
			memo += 1
if memo >= 1:
	print('No')
else:
	print('Yes')


n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
(b, a) = zip(*sorted(zip(b, a)))
sum = 0
for i in range(n):
	sum += a[i]
	if sum > b[i]:
		print('No')
		exit()
print('Yes')


n = int(input())
s = []
for i in range(n):
	(a, b) = map(int, input().split())
	s.append([b, a])
s.sort()
t = 0
ts = 0
for i in s:
	ts = i[0]
	t += i[1]
	if t > ts:
		print('No')
		break
else:
	print('Yes')


N = int(input())
Dic = dict()
for i in range(N):
	(A, B) = list(map(int, input().split()))
	if B not in Dic:
		Dic[B] = A
	else:
		Dic[B] += A
Deadlines = sorted(Dic)
Time = 0
for Deadline in Deadlines:
	if Time + Dic[Deadline] <= Deadline:
		Time += Dic[Deadline]
	else:
		Ans = 'No'
try:
	if Ans == 'No':
		print(Ans)
except:
	print('Yes')


n = int(input())
tasks = []
for _ in range(n):
	(a, b) = map(int, input().split())
	tasks.append([a, b])
tasks = sorted(tasks, key=lambda x: x[1])
time = 0
for task in tasks:
	time += task[0]
	if time > task[1]:
		print('No')
		return
print('Yes')


n = int(input())
lis = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda z: z[1])
t = 0
ans = 'Yes'
for i in lis:
	t += i[0]
	if t > i[1]:
		ans = 'No'
print(ans)


import numpy as np
N = int(input())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB_sort = sorted(AB, key=lambda x: x[1])
A = [x[0] for x in AB_sort]
B = [x[1] for x in AB_sort]
A_cum = np.array(A).cumsum()
for i in range(N):
	if A_cum[i] > B[i]:
		print('No')
		return
print('Yes')


n = int(input())
d = []
for i in range(n):
	(a, b) = map(int, input().split())
	d.append((b, a))
d.sort()
chk = 0
for i in d:
	chk += i[1]
	if chk > i[0]:
		print('No')
		exit()
print('Yes')


N = int(input())
tasks = []
for i in range(N):
	(A, B) = [int(x) for x in input().split()]
	tasks.append([B, A])
tasks.sort()
ok = True
S = 0
for i in range(N):
	(B, A) = (tasks[i][0], tasks[i][1])
	S += A
	if S > B:
		ok = False
		break
if ok == True:
	print('Yes')
else:
	print('No')


from itertools import accumulate
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
(a, b) = zip(*ab)
a = list(a)
b = list(b)
a = list(accumulate(a))
for (i, j) in zip(a, b):
	if i > j:
		print('No')
		break
else:
	print('Yes')


n = int(input())
task_time = {}
task_limit = {}
for i in range(1, n + 1):
	(a, b) = list(map(int, input().split()))
	task_time[i] = a
	task_limit[i] = b
task_limit_sorted = sorted(list(task_limit.items()), key=lambda x: x[1])
time = 0
for i in task_limit_sorted:
	time += task_time[i[0]]
	if task_limit[i[0]] < time:
		print('No')
		exit()
print('Yes')


n = int(input())
A = [[int(i) for i in input().split()] for j in range(n)]
A.sort(key=lambda x: x[1])
S = 0
for (a, b) in A:
	S += a
	if S > b:
		print('No')
		exit()
print('Yes')


n = int(input())
arr = [list(map(int, input().split())) for _ in range(n)]
arr = sorted(arr, key=lambda x: x[1])
sa = 0
for i in range(n):
	sa += arr[i][0]
	if sa > arr[i][1]:
		print('No')
		break
else:
	print('Yes')


n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
time = 0
ans = 'Yes'
for (a, b) in ab:
	time += a
	if time > b:
		ans = 'No'
print(ans)


N = int(input())
W = []
for i in range(N):
	W.append(list(map(int, input().split())))
W = sorted(W, key=lambda x: (x[1], x[0]))
now = 0
for w in W:
	if now + w[0] > w[1]:
		print('No')
		return
	now += w[0]
print('Yes')


n = int(input())
ab = [[int(i) for i in input().split()] for i in range(n)]
ab.sort(key=lambda x: x[1])
t = 0
for (a, b) in ab:
	t += a
	if b < t:
		print('No')
		exit()
print('Yes')


N = int(input())
L = []
for i in range(N):
	(A, B) = map(int, input().split())
	L.append([A, B])
L.sort(key=lambda x: x[1])
t = 0
for (a, b) in L:
	t += a
	if t > b:
		break
print('Yes' if t <= b else 'No')


N = int(input())
list = []
for i in range(N):
	(a, b) = map(int, input().split())
	list.append((b, a))
list.sort()
acc = 0
for i in range(N):
	acc += list[i][1]
	if acc > list[i][0]:
		print('No')
		exit()
print('Yes')


import sys
n = int(input())
l = []
for i in range(n):
	(a, b) = map(int, input().split())
	l.append([a, b])
l = sorted(l, key=lambda x: x[1])
c = 0
for i in range(n):
	c += l[i][0]
	if c > l[i][1]:
		print('No')
		return
	else:
		continue
print('Yes')


N = int(input())
li = []
ans = 'Yes'
t = 0
for i in range(N):
	(A, B) = list(map(int, input().split()))
	li.append([B, A])
li.sort()
for j in range(N):
	t += li[j][1]
	if t <= li[j][0]:
		pass
	else:
		ans = 'No'
print(ans)


n = int(input())
task = []
for i in range(n):
	(a, b) = map(int, input().split())
	task.append([b, a])
sorted_task = sorted(task)
isOK = True
ans = 0
for i in range(n):
	ans += sorted_task[i][1]
	if ans > sorted_task[i][0]:
		isOK = False
		break
if isOK:
	print('Yes')
else:
	print('No')


n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab = sorted(ab, key=lambda x: x[1])
j = True
x = 0
for (a, b) in ab:
	x += a
	if x > b:
		j = False
		break
print('Yes' if j else 'No')


def solve(N, ABs):
	ABs.sort(key=lambda x: x[1])
	time = 0
	ans = 'Yes'
	for (A, B) in ABs:
		time += A
		if time > B:
			ans = 'No'
			break
	print(ans)

def __starting_point():
	N = int(input())
	ABs = [[int(i) for i in input().split()] for _ in range(N)]
	solve(N, ABs)
__starting_point()


import sys
N = int(input())
V = [list(map(int, input().split())) for _ in range(N)]
V.sort(key=lambda x: x[1])
s = 0
for v in V:
	s += v[0]
	if s > v[1]:
		print('No')
		sys.exit()
print('Yes')


time = 0
n = int(input())
todo = [] * n
for i in range(n):
	(a, b) = map(int, input().split())
	todo.append([b, a])
todo.sort()
d = True
for i in range(n):
	time += todo[i][1]
	if todo[i][0] < time:
		d = False
		break
if d:
	print('Yes')
else:
	print('No')


import numpy as np
n = int(input())
ab = []
for _ in range(n):
	ab.append(list(map(int, input().split())))
ab = np.array(ab)
ab = ab[ab[:, 1].argsort()]
total_time = 0
flag = 0
for (_a, _b) in zip(ab[:, 0], ab[:, 1]):
	total_time += _a
	if total_time > _b:
		flag = 1
		break
if flag:
	print('No')
else:
	print('Yes')


N = int(input())
task = [tuple(map(int, input().split())) for _ in [0] * N]
task.sort(key=lambda x: x[1])
time = 0
flg = True
for (a, b) in task:
	time += a
	if b < time:
		flg = False
print(['No', 'Yes'][flg])


N = int(input())
work = [[] for i in range(N)]
for i in range(N):
	(a, b) = map(int, input().split())
	work[i] = [b, a]
work.sort()
total = 0
for i in range(N):
	total += work[i][1]
	if total > work[i][0]:
		print('No')
		return
print('Yes')


n = int(input())
ab = []
for _ in range(n):
	ab.append(tuple(map(int, input().split())))
ab = sorted(ab, key=lambda x: x[1])
ans = True
t = 0
for i in range(n):
	t += ab[i][0]
	if t > ab[i][1]:
		ans = False
print('Yes' if ans == True else 'No')


import heapq

def solve():
	N = int(input())
	que = []
	for i in range(N):
		(a, b) = list(map(int, input().split()))
		heapq.heappush(que, (b, a))
	now = 0
	while que:
		(b, a) = heapq.heappop(que)
		now += a
		if now > b:
			return False
	return True
if solve():
	print('Yes')
else:
	print('No')


from itertools import accumulate
n = int(input())
a = sorted((tuple(map(int, input().split()))[::-1] for _ in range(n)))
(c, d) = zip(*a)
print('YNeos'[any((x < y for (x, y) in zip(c, accumulate(d))))::2])


n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
t = 0
ok = True
for (a, b) in ab:
	t += a
	if t > b:
		ok = False
print('Yes' if ok else 'No')


Row = int(input())
List = []
for i in range(Row):
	List.append(list(map(int, input().split())))
List = sorted(List, key=lambda x: x[1])
res = 0
flag = True
for i in range(Row):
	res += List[i][0]
	if res > List[i][1]:
		flag = False
		break
if flag:
	print('Yes')
else:
	print('No')


n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda l: l[1])
t = 0
out = 'Yes'
for i in range(n):
	t += ab[i][0]
	if t > ab[i][1]:
		out = 'No'
		break
print(out)


n = int(input())
task = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x: x[1])
t = 0
for (a, b) in task:
	t += a
	if t > b:
		print('No')
		return
print('Yes')


n = int(input())
x = [[int(i) for i in input().split()] for i in range(n)]
x.sort(key=lambda x: x[1])
(p, ans) = (0, 'Yes')
for (i, j) in x:
	p += i
	if p > j:
		ans = 'No'
print(ans)


N = int(input())
L = [tuple(map(int, input().split())) for _ in range(N)]
L.sort(key=lambda x: x[1])
work = 0
for n in range(N):
	work += L[n][0]
	if work > L[n][1]:
		print('No')
		exit()
print('Yes')


N = int(input())
AB = []
for _ in range(N):
	AB.append([int(x) for x in input().split()])
AB.sort(key=lambda x: x[1])
sum = 0
for (a, b) in AB:
	sum += a
	if sum > b:
		print('No')
		break
else:
	print('Yes')


n = int(input())
j = []
for i in range(n):
	(a, b) = map(int, input().split())
	j.append((b, a))
j.sort()
ct = 0
for i in j:
	ct += i[1]
	if ct > i[0]:
		print('No')
		break
else:
	print('Yes')


N = int(input())
A = [list(map(int, input().split())) for i in range(N)]
A = sorted(A, key=lambda x: x[1])
S = 0
T = True
for i in range(N):
	S += A[i][0]
	if A[i][1] < S:
		T = False
if T == True:
	print('Yes')
else:
	print('No')


N = int(input())
limit2time = []
for i in range(N):
	(time, limit) = map(int, input().split())
	limit2time.append((limit, time))
limit2time = sorted(limit2time, key=lambda x: x[0])
cur = 0
for item in limit2time:
	(key, time) = item
	if cur + time > key:
		print('No')
		break
	cur += time
else:
	print('Yes')


N = int(input())
W = list()
for i in range(N):
	(a, b) = map(int, input().split())
	W.append((a, b))
W.sort(key=lambda x: x[1])
res = 0
for i in range(N):
	res += W[i][0]
	if res > W[i][1]:
		print('No')
		break
else:
	print('Yes')


N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
AB = sorted(AB, key=lambda i: i[1])
count = 0
for i in range(N):
	count += AB[i][0]
	if AB[i][1] < count:
		print('No')
		return
else:
	print('Yes')


n = int(input())
ab = [list(map(int, input().split())) for i in range(n)]
ab = sorted(ab, key=lambda x: x[1])
a = 0
for (i, j) in ab:
	a += i
	if a > j:
		print('No')
		exit()
print('Yes')


N = int(input())
x = [list(map(int, input().split(' '))) for i in range(N)]
x = sorted(x, key=lambda x: x[1], reverse=False)
T = 0
for e in x:
	T += e[0]
	if e[1] < T:
		print('No')
		exit()
print('Yes')


import sys
n = int(input())
ba = [[0] * 2 for i in range(n)]
for i in range(n):
	(ai, bi) = map(int, input().split())
	ba[i] = [bi, ai]
ba.sort()
t = 0
for i in range(n):
	t += ba[i][1]
	if t > ba[i][0]:
		print('No')
		return
print('Yes')


n = int(input())
d = [list(map(int, input().split())) for i in range(n)]
d.sort(key=lambda x: x[1])
ans = 'Yes'
t = 0
for i in d:
	t += i[0]
	if t > i[1]:
		ans = 'No'
print(ans)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy
from operator import itemgetter
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
stdin = sys.stdin
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
ns = lambda : stdin.readline().rstrip()
n = ni()
ab = [na() for _ in range(n)]
ab.sort(key=itemgetter(1, 0))
now = 0
ans = 'Yes'
for i in range(n):
	(a, b) = ab[i]
	now += a
	if now > b:
		ans = 'No'
		break
print(ans)


N = int(input())
a = [list(map(int, input().split())) for _ in range(N)]
a = sorted(a, key=lambda x: x[1])
hours = 0
ans = 'Yes'
for pair in a:
	hours += pair[0]
	deadline = pair[1]
	if hours > deadline:
		ans = 'No'
		break
print(ans)


n = int(input())
al = list((list(map(int, input().split())) for _ in range(n)))
al_s = sorted(al, key=lambda x: x[1])
time_sum = 0
for i in range(n):
	(time, limit) = (al_s[i][0], al_s[i][1])
	time_sum += time
	if limit < time_sum:
		print('No')
		return
else:
	print('Yes')


n = int(input())
l = sorted([list(map(int, input().split())) for nd in range(n)], key=lambda x: x[1])
now = 0
for (a, s) in l:
	if a + now > s:
		print('No')
		exit()
	now += a
else:
	print('Yes')


N = int(input())
l = [list(map(int, input().split())) for _ in range(N)]
l = sorted(l, key=lambda x: x[1])
t = 0
for (A, B) in l:
	t += A
	if t > B:
		print('No')
		break
else:
	print('Yes')


def main():
	N = int(input())
	works = []
	for i in range(N):
		(A, B) = list(map(int, input().split()))
		works.append((A, B))
	works.sort(key=lambda x: x[1])
	time = 0
	for i in range(N):
		(a, b) = works[i]
		time += a
		if time > b:
			print('No')
			return
	print('Yes')

def __starting_point():
	main()
__starting_point()


n = int(input())
g = sorted([list(map(int, input().split())) for i in range(n)], key=lambda x: x[1])
time = 0
for (s, t) in g:
	time += s
	if time > t:
		print('No')
		exit()
print('Yes')


ab = sorted([list(map(int, input().split())) for _ in range(int(input()))], key=lambda x: (x[1], x[0]))
time = 0
for l in ab:
	time += l[0]
	if time > l[1]:
		print('No')
		quit()
print('Yes')


N = int(input())
task = [[]] * N
for i in range(N):
	task[i] = list(map(int, input().split()))
task.sort(key=lambda x: x[1])
t = 0
for i in range(N):
	t += task[i][0]
	if task[i][1] < t:
		print('No')
		return
print('Yes')


n = int(input())
a = []
b = []
for _ in range(n):
	c = list(map(int, input().split()))
	a.append(c[0])
	b.append(c[1])
d = list(zip(b, a))
d.sort()
time = 0
for i in range(n):
	time += d[i][1]
	if d[i][0] < time:
		print('No')
		return
print('Yes')


import numpy as np
N = int(input())
ls = []
for _ in range(N):
	p = list(map(int, input().split()))
	ls.append(p)
ls.sort(key=lambda x: x[1])
time = 0
for i in range(N):
	time += ls[i][0]
	if ls[i][1] < time:
		print('No')
		return
	else:
		pass
print('Yes')


import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readlines

def main():
	lines = input()
	n = int(lines[0].strip())
	E = [list(map(int, lines[i].split())) for i in range(1, n + 1)]
	E = sorted(E, key=lambda x: x[1])
	cur_t = 0
	for i in range(n):
		cur_t += E[i][0]
		if cur_t > E[i][1]:
			print('No')
			return
	print('Yes')
main()


n = int(input())
l = [tuple(map(int, input().split())) for i in range(n)]
l.sort(key=lambda x: x[1])
cnt = 0
for t in l:
	cnt += t[0]
	if cnt > t[1]:
		print('No')
		exit()
print('Yes')


N = int(input())
AB = []
for _ in range(N):
	AB.append(list(map(int, input().split())))
sorted_AB = sorted(AB, key=lambda x: (x[1], -x[0]))
worked = 0
for ab in sorted_AB:
	worked += ab[0]
	if worked > ab[1]:
		print('No')
		return
print('Yes')


N = int(input())
jobs = [0] * N
for i in range(N):
	(a, b) = list(map(int, input().split()))
	jobs[i] = (a, b)
jobs.sort(key=lambda x: x[1])
now = 0
jobIndex = 0
for i in range(N):
	if now + jobs[i][0] > jobs[i][1]:
		print('No')
		return
	now += jobs[i][0]
print('Yes')