n = int(eval(input()))

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

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

t = 0

for a, b in ar:

    t += a

    if b < t:

        print('No')

        exit(0)

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

l = [None] * n

for i in range(n):

  l[i] = list(map(int, input().split()))

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

t = 0

for a, b in l:

  t += a

  if t > b:

    print('No')

    exit(0)

print('Yes')
n = int(eval(input()))
ar = [list(map(int, input().split())) for _ in range(n)]
ar.sort(key=lambda x: x[1])
t = 0
for a, b in ar:
    t += a
    if b < t:
        print("No")
        exit(0)
print("Yes")

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

-ar = [list(map(int, input().split())) for _ in range(n)] -ar.sort(key=lambda x: x[1]) +l = [None] * n +for i in range(n): +    l[i] = list(map(int, input().split())) +l.sort(key=lambda x: x[1]) -for a, b in ar: +for a, b in l: -    if b < t: +    if t > b: