import sys

input = sys.stdin.readline



n = int(eval(input()))

ab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])



cnt = 0

for b, a in ab:

    cnt += a

    if cnt > b:

        print('No')

        break

else:

    print('Yes')

n = int(eval(input()))

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

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



t = 0

for a, b in ab:

    t += a

    if t > b:

        print('No')

        break

else:

    print('Yes')

import sys

input = sys.stdin.readline
n = int(eval(input()))
ab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])
cnt = 0
for b, a in ab:
    cnt += a
    if cnt > b:
        print("No")
        break
else:
    print("Yes")

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

-import sys - -input = sys.stdin.readline -ab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)]) -cnt = 0 -for b, a in ab: -    cnt += a -    if cnt > b: +ab = [list(map(int, input().split())) for _ in range(n)] +ab = sorted(ab, key=lambda x: x[1]) +t = 0 +for a, b in ab: +    t += a +    if t > b: