n = int(eval(input()))



task_list = []



for i in range(n):

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

    task_list.append((a, b))



task_list = sorted(task_list, key=lambda x: x[1])



current = 0



for task in task_list:

    current += task[0]

    if current > task[1]:

        print("No")

        exit()



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

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

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



current_time = 0



for task in tasks:

    current_time += task[0]

    if current_time > task[1]:

        print("No")

        exit()



print("Yes")
n = int(eval(input()))
task_list = []
for i in range(n):
    a, b = list(map(int, input().split()))
    task_list.append((a, b))
task_list = sorted(task_list, key=lambda x: x[1])
current = 0
for task in task_list:
    current += task[0]
    if current > task[1]:
        print("No")
        exit()
print("Yes")

n = int(eval(input()))
tasks = [list(map(int, input().split())) for _ in range(n)]
tasks.sort(key=lambda x: x[1])
current_time = 0
for task in tasks:
    current_time += task[0]
    if current_time > task[1]:
        print("No")
        exit()
print("Yes")

-task_list = [] -for i in range(n): -    a, b = list(map(int, input().split())) -    task_list.append((a, b)) -task_list = sorted(task_list, key=lambda x: x[1]) -current = 0 -for task in task_list: -    current += task[0] -    if current > task[1]: +tasks = [list(map(int, input().split())) for _ in range(n)] +tasks.sort(key=lambda x: x[1]) +current_time = 0 +for task in tasks: +    current_time += task[0] +    if current_time > task[1]: