n = int(eval(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)
n = int(eval(input()))

from bisect import bisect 

ab = [list(map(int,input().split())) for i in range(n)]



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

ok = True

last = 0

for a,b in ab:

    if b-a>=last:

        last += a

    else:

        ok = not ok

        break

print(('Yes' if ok else 'No'))
n = int(eval(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)

n = int(eval(input()))
from bisect import bisect

ab = [list(map(int, input().split())) for i in range(n)]
ab.sort(key=lambda x: x[1])
ok = True
last = 0
for a, b in ab:
    if b - a >= last:
        last += a
    else:
        ok = not ok
        break
print(("Yes" if ok else "No"))

-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) +from bisect import bisect + +ab = [list(map(int, input().split())) for i in range(n)] +ab.sort(key=lambda x: x[1]) +ok = True +last = 0 +for a, b in ab: +    if b - a >= last: +        last += a +    else: +        ok = not ok +        break +print(("Yes" if ok else "No"))