N = int(eval(input()))

job_list = list()

for i in range(N):

    job_list.append(tuple(map(int, str(eval(input())).split())))



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



time = 0

for i in range(N):

    time += job_list[i][0]

    if time > job_list[i][1]:

        print('No')

        exit()



print('Yes')

from collections import OrderedDict

if __name__ == "__main__":

    n = int(eval(input()))

    job = dict()

    for i in range(n):

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

        if tmp[1] in job:

            job[tmp[1]].append(tmp[0])

        else:

            job[tmp[1]] = [tmp[0]]



    sch = sorted(job)



    time = 0

    for j in sch:

        time += sum(job[j])

        if time <= j:

            continue

        else:

            print('No')

            exit()



    print('Yes')

N = int(eval(input()))
job_list = list()
for i in range(N):
    job_list.append(tuple(map(int, str(eval(input())).split())))
job_list = sorted(job_list, key=lambda x: (x[1], x[0]))
time = 0
for i in range(N):
    time += job_list[i][0]
    if time > job_list[i][1]:
        print("No")
        exit()
print("Yes")

from collections import OrderedDict

if __name__ == "__main__":
    n = int(eval(input()))
    job = dict()
    for i in range(n):
        tmp = list(map(int, input().split()))
        if tmp[1] in job:
            job[tmp[1]].append(tmp[0])
        else:
            job[tmp[1]] = [tmp[0]]
    sch = sorted(job)
    time = 0
    for j in sch:
        time += sum(job[j])
        if time <= j:
            continue
        else:
            print("No")
            exit()
    print("Yes")

-N = int(eval(input())) -job_list = list() -for i in range(N): -    job_list.append(tuple(map(int, str(eval(input())).split()))) -job_list = sorted(job_list, key=lambda x: (x[1], x[0])) -time = 0 -for i in range(N): -    time += job_list[i][0] -    if time > job_list[i][1]: -        print("No") -        exit() -print("Yes") +from collections import OrderedDict + +if __name__ == "__main__": +    n = int(eval(input())) +    job = dict() +    for i in range(n): +        tmp = list(map(int, input().split())) +        if tmp[1] in job: +            job[tmp[1]].append(tmp[0]) +        else: +            job[tmp[1]] = [tmp[0]] +    sch = sorted(job) +    time = 0 +    for j in sch: +        time += sum(job[j]) +        if time <= j: +            continue +        else: +            print("No") +            exit() +    print("Yes")