N = int(eval(input()))

li = []

for _ in range(N):

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

    li.append([b,a,b])



flag = True

now = 0

li = sorted(li)



for a, b, c in li:

    now += b

    if now > c:

        print("No")

        flag = False

        break

        

if flag:

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

ab_list = []

for _ in range(N):

    ab_list.append([int(x) for x in input().split()])

    

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



sum_work = 0

res = 'Yes'

for a, b in ab_list:

    sum_work += a

    if sum_work > b:

        res = 'No'

        break

print(res)
N = int(eval(input()))
li = []
for _ in range(N):
    a, b = list(map(int, input().split()))
    li.append([b, a, b])
flag = True
now = 0
li = sorted(li)
for a, b, c in li:
    now += b
    if now > c:
        print("No")
        flag = False
        break
if flag:
    print("Yes")

N = int(eval(input()))
ab_list = []
for _ in range(N):
    ab_list.append([int(x) for x in input().split()])
ab_list = sorted(ab_list, key=lambda x: x[-1])
sum_work = 0
res = "Yes"
for a, b in ab_list:
    sum_work += a
    if sum_work > b:
        res = "No"
        break
print(res)

-li = [] +ab_list = [] -    a, b = list(map(int, input().split())) -    li.append([b, a, b]) -flag = True -now = 0 -li = sorted(li) -for a, b, c in li: -    now += b -    if now > c: -        print("No") -        flag = False +    ab_list.append([int(x) for x in input().split()]) +ab_list = sorted(ab_list, key=lambda x: x[-1]) +sum_work = 0 +res = "Yes" +for a, b in ab_list: +    sum_work += a +    if sum_work > b: +        res = "No" -if flag: -    print("Yes") +print(res)