N = int(eval(input()))

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



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



t = 0

ans = "Yes"



for i in range(N):

    a = task[i][0]

    b = task[i][1]

    t += a

    if t > b:

        ans = "No"

        break



print(ans)

N = int(eval(input()))

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



t = 0

ans = "Yes"



for a, b in sorted(task, key=lambda x: x[1]):

    t += a

    if t > b:

        ans = "No"

        break



print(ans)

N = int(eval(input()))
task = [list(map(int, input().split())) for _ in range(N)]
task.sort(key=lambda x: x[1])
t = 0
ans = "Yes"
for i in range(N):
    a = task[i][0]
    b = task[i][1]
    t += a
    if t > b:
        ans = "No"
        break
print(ans)

N = int(eval(input()))
task = [list(map(int, input().split())) for _ in range(N)]
t = 0
ans = "Yes"
for a, b in sorted(task, key=lambda x: x[1]):
    t += a
    if t > b:
        ans = "No"
        break
print(ans)

-task.sort(key=lambda x: x[1]) -for i in range(N): -    a = task[i][0] -    b = task[i][1] +for a, b in sorted(task, key=lambda x: x[1]):