n = int(eval(input()))



work = [0]*n

for i in range(n):

  a, b = list(map(int, input().split()))

  work[i] = [b, a]

work.sort()



key = 0

ans = True

for i in range(n):

  if key + work[i][1]> work[i][0]:

    ans = False

    break

  key += work[i][1]



if ans:

  print("Yes")

else:

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



jobs = [None]*n

for i in range(n):

  a, b = list(map(int, input().split()))

  jobs[i] = (b, a)



jobs.sort()



ans = True

sub = 0

for i in range(n):

  b, a = jobs[i][0], jobs[i][1]

  sub += a

  if sub > b:

    ans = False

    break



print(("Yes" if ans else "No"))
n = int(eval(input()))
work = [0] * n
for i in range(n):
    a, b = list(map(int, input().split()))
    work[i] = [b, a]
work.sort()
key = 0
ans = True
for i in range(n):
    if key + work[i][1] > work[i][0]:
        ans = False
        break
    key += work[i][1]
if ans:
    print("Yes")
else:
    print("No")

n = int(eval(input()))
jobs = [None] * n
for i in range(n):
    a, b = list(map(int, input().split()))
    jobs[i] = (b, a)
jobs.sort()
ans = True
sub = 0
for i in range(n):
    b, a = jobs[i][0], jobs[i][1]
    sub += a
    if sub > b:
        ans = False
        break
print(("Yes" if ans else "No"))

-work = [0] * n +jobs = [None] * n -    work[i] = [b, a] -work.sort() -key = 0 +    jobs[i] = (b, a) +jobs.sort() +sub = 0 -    if key + work[i][1] > work[i][0]: +    b, a = jobs[i][0], jobs[i][1] +    sub += a +    if sub > b: -    key += work[i][1] -if ans: -    print("Yes") -else: -    print("No") +print(("Yes" if ans else "No"))