N=int(eval(input()))

AB = [[int(i) for i in input().split()] for j in range(N)]

ABDeadStart = [[A,B,B-A] for A,B in AB]#所要時間、初めてないと駄目な時間

MaxShoyou = sum([a for a,b,kaisi in ABDeadStart])

ABDeadStart.sort(key = lambda x:x[2]-MaxShoyou+x[0])

curtime = 0

NO =0

for a,b,ds in ABDeadStart:

    if curtime <= ds:

        curtime += a

    else:

        NO =True

        break

if NO :print("No")

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

AB = [tuple(map(int,input().split())) for i in range(N)]

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

curtime = 0

clear = True

for a,b in AB:

    curtime += a

    if curtime > b:

        clear = False

        break

if clear:print("Yes")

else:print("No")
N = int(eval(input()))
AB = [[int(i) for i in input().split()] for j in range(N)]
ABDeadStart = [[A, B, B - A] for A, B in AB]  # 所要時間、初めてないと駄目な時間
MaxShoyou = sum([a for a, b, kaisi in ABDeadStart])
ABDeadStart.sort(key=lambda x: x[2] - MaxShoyou + x[0])
curtime = 0
NO = 0
for a, b, ds in ABDeadStart:
    if curtime <= ds:
        curtime += a
    else:
        NO = True
        break
if NO:
    print("No")
else:
    print("Yes")

N = int(eval(input()))
AB = [tuple(map(int, input().split())) for i in range(N)]
AB.sort(key=lambda x: x[1])
curtime = 0
clear = True
for a, b in AB:
    curtime += a
    if curtime > b:
        clear = False
        break
if clear:
    print("Yes")
else:
    print("No")

-AB = [[int(i) for i in input().split()] for j in range(N)] -ABDeadStart = [[A, B, B - A] for A, B in AB]  # 所要時間、初めてないと駄目な時間 -MaxShoyou = sum([a for a, b, kaisi in ABDeadStart]) -ABDeadStart.sort(key=lambda x: x[2] - MaxShoyou + x[0]) +AB = [tuple(map(int, input().split())) for i in range(N)] +AB.sort(key=lambda x: x[1]) -NO = 0 -for a, b, ds in ABDeadStart: -    if curtime <= ds: -        curtime += a -    else: -        NO = True +clear = True +for a, b in AB: +    curtime += a +    if curtime > b: +        clear = False -if NO: +if clear: +    print("Yes") +else: -else: -    print("Yes")