from operator import itemgetter

n = int(eval(input()))

data = []

for i in range(n):

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

data.sort(key = itemgetter(1))

time = 0

for i in range(n):

    time += data[i][0]

    if time > data[i][1]:

        print("No")

        exit()

print("Yes")
n = int(eval(input()))

data = []

for i in range(n):

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

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

now = 0

for i in range(n):

    now += data[i][0]

    if now > data[i][1]:

        print("No")

        exit()

print("Yes")
from operator import itemgetter

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

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

-from operator import itemgetter - -data.sort(key=itemgetter(1)) -time = 0 +data.sort(key=lambda x: x[1]) +now = 0 -    time += data[i][0] -    if time > data[i][1]: +    now += data[i][0] +    if now > data[i][1]: