N = int(eval(input()))

lis = []

for i in range(N):

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

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

a = 0

for j in range(N):

    a += lis[j][0]

    if a > lis[j][1]:

        print('No')

        exit()

print('Yes')
N = int(eval(input()))

lis = []

for i in range(N):

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

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

a = 0

for j in range(N):

    a += lis[j][0]

    if a > lis[j][1]:

        print('No')

        exit()

print('Yes')
N = int(eval(input()))
lis = []
for i in range(N):
    lis.append(list(map(int, input().split())))
lis = sorted(lis, key=lambda x: x[1])
a = 0
for j in range(N):
    a += lis[j][0]
    if a > lis[j][1]:
        print("No")
        exit()
print("Yes")

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

-lis = sorted(lis, key=lambda x: x[1]) +lis.sort(key=lambda x: x[1])