n = int(eval(input()))

b = []

for i in range(n):

    x,y = list(map(int,input().split()))

    b.append([y,x])

b.sort()

ans = 'Yes'

t = 0

for i in range(n):

    t += b[i][1]

    if t>b[i][0]:

        ans='No'

print(ans)

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()))
b = []
for i in range(n):
    x, y = list(map(int, input().split()))
    b.append([y, x])
b.sort()
ans = "Yes"
t = 0
for i in range(n):
    t += b[i][1]
    if t > b[i][0]:
        ans = "No"
print(ans)

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)

-b = [] -for i in range(n): -    x, y = list(map(int, input().split())) -    b.append([y, x]) -b.sort() +d = [list(map(int, input().split())) for i in range(n)] +d.sort(key=lambda x: x[1]) -for i in range(n): -    t += b[i][1] -    if t > b[i][0]: +for i in d: +    t += i[0] +    if t > i[1]: