n = int(eval(input()))

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

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

now = 0

for i in ab:

    if i[1] >= now + i[0]:

        now += i[0]

    else:

        print("No")

        exit()

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

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

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

temp=0

for i in ab:

    temp+=i[0]

    if temp>i[1]:

        print("No")

        exit()

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

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

-ab = sorted(ab, key=lambda x: x[1]) -now = 0 +ab.sort(key=lambda x: x[1]) +temp = 0 -    if i[1] >= now + i[0]: -        now += i[0] -    else: +    temp += i[0] +    if temp > i[1]: