N = int(eval(input()))

res = 'Yes'

A = [[0 for j in range(2)] for i in range(N)]

for i in range(N):

  A[i][0], A[i][1] = list(map(int, input().split(' ')))

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

A.append([0, 0])

total = 0

i = 0

while i < N:

  while True:

    total += A[i][0]

    if A[i][1] != A[i + 1][1]:

      break

    i += 1

  if A[i][1] < total:

    res = 'No'

    break

  i += 1

print(res)
N = int(eval(input()))

A_B = [[0 for _ in range(2)] for _ in range(N)]

total = 0

res = 'Yes'

for i in range(N):

  A_B[i][0], A_B[i][1] = list(map(int, input().split(' ')))

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

for i in range(N):

  total += A_B[i][0]

  if total > A_B[i][1]:

    res = 'No'

    break

print(res)
N = int(eval(input()))
res = "Yes"
A = [[0 for j in range(2)] for i in range(N)]
for i in range(N):
    A[i][0], A[i][1] = list(map(int, input().split(" ")))
A.sort(key=lambda x: x[1])
A.append([0, 0])
total = 0
i = 0
while i < N:
    while True:
        total += A[i][0]
        if A[i][1] != A[i + 1][1]:
            break
        i += 1
    if A[i][1] < total:
        res = "No"
        break
    i += 1
print(res)

N = int(eval(input()))
A_B = [[0 for _ in range(2)] for _ in range(N)]
total = 0
res = "Yes"
for i in range(N):
    A_B[i][0], A_B[i][1] = list(map(int, input().split(" ")))
A_B.sort(key=lambda x: x[1])
for i in range(N):
    total += A_B[i][0]
    if total > A_B[i][1]:
        res = "No"
        break
print(res)

+A_B = [[0 for _ in range(2)] for _ in range(N)] +total = 0 -A = [[0 for j in range(2)] for i in range(N)] -    A[i][0], A[i][1] = list(map(int, input().split(" "))) -A.sort(key=lambda x: x[1]) -A.append([0, 0]) -total = 0 -i = 0 -while i < N: -    while True: -        total += A[i][0] -        if A[i][1] != A[i + 1][1]: -            break -        i += 1 -    if A[i][1] < total: +    A_B[i][0], A_B[i][1] = list(map(int, input().split(" "))) +A_B.sort(key=lambda x: x[1]) +for i in range(N): +    total += A_B[i][0] +    if total > A_B[i][1]: -    i += 1