import heapq

import copy

import bisect

from collections import deque



n = int(eval(input()))

a = []

b = []

tmp_a = []

tmp_b = []

flag = True



for _ in range(n):

	a_dash,b_dash = list(map(int,input().split()))

	tmp_a.append(a_dash)

	tmp_b.append(b_dash)



k = list(zip(tmp_b,tmp_a))

sorted_k = sorted(k)

for b_dash,a_dash in sorted_k:

	a.append(a_dash)

	b.append(b_dash)



t = 0

qa = deque(a)

qb = deque(b)



for i in range(n):

	minimum_a = qa.popleft()

	minimum_b = qb.popleft()

	t += minimum_a

	if t > minimum_b:

		flag = False

		break



if flag:

	print('Yes')

else:

	print('No')

from collections import deque

import sys



n = int(eval(input()))



ab = []

for _ in range(n):

	ab.append(list(map(int,input().split())))



ab = sorted(ab, key=lambda x:x[1], reverse=True)



d = []

d = deque(d)

num = 0

while len(ab) > 0:

	d = deque([])

	d.append(ab.pop())

	while True:

		if len(ab) == 0:

			break

		if ab[-1][1] == d[0][1]:

			d.append(ab.pop())

		else:

			break

	for i in range(len(d)):

		a,b = d.pop()

		num += a

	if num > b:

		print('No')

		sys.exit()



print('Yes')

import heapq
import copy
import bisect
from collections import deque

n = int(eval(input()))
a = []
b = []
tmp_a = []
tmp_b = []
flag = True
for _ in range(n):
    a_dash, b_dash = list(map(int, input().split()))
    tmp_a.append(a_dash)
    tmp_b.append(b_dash)
k = list(zip(tmp_b, tmp_a))
sorted_k = sorted(k)
for b_dash, a_dash in sorted_k:
    a.append(a_dash)
    b.append(b_dash)
t = 0
qa = deque(a)
qb = deque(b)
for i in range(n):
    minimum_a = qa.popleft()
    minimum_b = qb.popleft()
    t += minimum_a
    if t > minimum_b:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")

from collections import deque
import sys

n = int(eval(input()))
ab = []
for _ in range(n):
    ab.append(list(map(int, input().split())))
ab = sorted(ab, key=lambda x: x[1], reverse=True)
d = []
d = deque(d)
num = 0
while len(ab) > 0:
    d = deque([])
    d.append(ab.pop())
    while True:
        if len(ab) == 0:
            break
        if ab[-1][1] == d[0][1]:
            d.append(ab.pop())
        else:
            break
    for i in range(len(d)):
        a, b = d.pop()
        num += a
    if num > b:
        print("No")
        sys.exit()
print("Yes")

-import heapq -import copy -import bisect +import sys -a = [] -b = [] -tmp_a = [] -tmp_b = [] -flag = True +ab = [] -    a_dash, b_dash = list(map(int, input().split())) -    tmp_a.append(a_dash) -    tmp_b.append(b_dash) -k = list(zip(tmp_b, tmp_a)) -sorted_k = sorted(k) -for b_dash, a_dash in sorted_k: -    a.append(a_dash) -    b.append(b_dash) -t = 0 -qa = deque(a) -qb = deque(b) -for i in range(n): -    minimum_a = qa.popleft() -    minimum_b = qb.popleft() -    t += minimum_a -    if t > minimum_b: -        flag = False -        break -if flag: -    print("Yes") -else: -    print("No") +    ab.append(list(map(int, input().split()))) +ab = sorted(ab, key=lambda x: x[1], reverse=True) +d = [] +d = deque(d) +num = 0 +while len(ab) > 0: +    d = deque([]) +    d.append(ab.pop()) +    while True: +        if len(ab) == 0: +            break +        if ab[-1][1] == d[0][1]: +            d.append(ab.pop()) +        else: +            break +    for i in range(len(d)): +        a, b = d.pop() +        num += a +    if num > b: +        print("No") +        sys.exit() +print("Yes")