N=int(eval(input()))

works=[]

for i in range(N):

    [a,b]=[int(_) for _ in input().split()]

    works.append([b,a])

works.sort()

works2=works[:1]

for work in works[1:]:

    if work[0]==works2[-1][0]:

        works2[-1][1]+=work[1]

    else:

        works2.append([work[0],works2[-1][1]])

        works2[-1][1]+=work[1]



if all([work[0]>=work[1] for work in works2]):

    print('Yes')

else:

    print('No')
n = int(eval(input()))

W = []

for i in range(n):

    a, b = list(map(int, input().split()))

    W.append((a, b))

W.sort(key=lambda x: x[1])

x = 0

for i in range(n):

    a, b = W[i]

    x += a

    if x > b:

        print('No')

        exit()

print('Yes')

N = int(eval(input()))
works = []
for i in range(N):
    [a, b] = [int(_) for _ in input().split()]
    works.append([b, a])
works.sort()
works2 = works[:1]
for work in works[1:]:
    if work[0] == works2[-1][0]:
        works2[-1][1] += work[1]
    else:
        works2.append([work[0], works2[-1][1]])
        works2[-1][1] += work[1]
if all([work[0] >= work[1] for work in works2]):
    print("Yes")
else:
    print("No")

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

-N = int(eval(input())) -works = [] -for i in range(N): -    [a, b] = [int(_) for _ in input().split()] -    works.append([b, a]) -works.sort() -works2 = works[:1] -for work in works[1:]: -    if work[0] == works2[-1][0]: -        works2[-1][1] += work[1] -    else: -        works2.append([work[0], works2[-1][1]]) -        works2[-1][1] += work[1] -if all([work[0] >= work[1] for work in works2]): -    print("Yes") -else: -    print("No") +n = int(eval(input())) +W = [] +for i in range(n): +    a, b = list(map(int, input().split())) +    W.append((a, b)) +W.sort(key=lambda x: x[1]) +x = 0 +for i in range(n): +    a, b = W[i] +    x += a +    if x > b: +        print("No") +        exit() +print("Yes")