N = int (eval(input()))

work = []

work_time = 0

flag = 0



for i in range(N):

    work.append(list(map(int , input().split())))

#print(work)

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

#work.sort()

#sort(work)

#print()

#print("sorting ... ")

#print()

#print(work)

for i in range(N):

    work_time += work[i][0]

    if work_time > work[i][1]:

        flag = 1

        break



if flag == 1:

    print('No')

else:

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

AB = list(list(map(int, input().split())) for _ in range(N))

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

now = 0

for a, b in AB:

    now += a

    if now > b:

        print("No")

        exit()

print("Yes")
N = int(eval(input()))
work = []
work_time = 0
flag = 0
for i in range(N):
    work.append(list(map(int, input().split())))
# print(work)
work = sorted(work, key=lambda x: x[1])
# work.sort()
# sort(work)
# print()
# print("sorting ... ")
# print()
# print(work)
for i in range(N):
    work_time += work[i][0]
    if work_time > work[i][1]:
        flag = 1
        break
if flag == 1:
    print("No")
else:
    print("Yes")

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

-work = [] -work_time = 0 -flag = 0 -for i in range(N): -    work.append(list(map(int, input().split()))) -# print(work) -work = sorted(work, key=lambda x: x[1]) -# work.sort() -# sort(work) -# print() -# print("sorting ... ") -# print() -# print(work) -for i in range(N): -    work_time += work[i][0] -    if work_time > work[i][1]: -        flag = 1 -        break -if flag == 1: -    print("No") -else: -    print("Yes") +AB = list(list(map(int, input().split())) for _ in range(N)) +AB.sort(key=lambda x: x[1]) +now = 0 +for a, b in AB: +    now += a +    if now > b: +        print("No") +        exit() +print("Yes")