def main():

    N=int(eval(input()))

    AB=[0]*N

    for i in range(N):

        ab=list(map(int,input().split()))

        AB[i]=ab

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

    t=0

    flag=True

    for i in range(N):

        t+=AB[i][0]

        if t>AB[i][1]:

            print("No")

            flag=False

            break

    if flag:

        print("Yes")

if __name__=="__main__":

    main()
from sys import stdin

def main():

    #入力

    readline=stdin.readline

    N=int(readline())

    li=[]

    for i in range(N):

        ab=list(map(int,readline().split()))

        li.append(ab)

    

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

    t=0

    for i in range(N):

        task=li[i]

        t+=task[0]

        if t>task[1]:

            print("No")

            break

    else:

        print("Yes")

if __name__=="__main__":

    main()
def main():
    N = int(eval(input()))
    AB = [0] * N
    for i in range(N):
        ab = list(map(int, input().split()))
        AB[i] = ab
    AB.sort(key=lambda x: x[1])
    t = 0
    flag = True
    for i in range(N):
        t += AB[i][0]
        if t > AB[i][1]:
            print("No")
            flag = False
            break
    if flag:
        print("Yes")


if __name__ == "__main__":
    main()

from sys import stdin


def main():
    # 入力
    readline = stdin.readline
    N = int(readline())
    li = []
    for i in range(N):
        ab = list(map(int, readline().split()))
        li.append(ab)
    li.sort(key=lambda x: x[1])
    t = 0
    for i in range(N):
        task = li[i]
        t += task[0]
        if t > task[1]:
            print("No")
            break
    else:
        print("Yes")


if __name__ == "__main__":
    main()

+from sys import stdin + + -    N = int(eval(input())) -    AB = [0] * N +    # 入力 +    readline = stdin.readline +    N = int(readline()) +    li = [] -        ab = list(map(int, input().split())) -        AB[i] = ab -    AB.sort(key=lambda x: x[1]) +        ab = list(map(int, readline().split())) +        li.append(ab) +    li.sort(key=lambda x: x[1]) -    flag = True -        t += AB[i][0] -        if t > AB[i][1]: +        task = li[i] +        t += task[0] +        if t > task[1]: -            flag = False -    if flag: +    else: