n = int(eval(input()))

works = []

for i in range(n):

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



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



def ans(works):

    time = 0

    for work in works:

        time += work[0]

        if time > work[1]:

            print("No")

            return

    print("Yes")

    return



ans(works)

n = int(eval(input()))

ab = [list(map(int, input().split())) for _ in range(n)]



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

time = 0

ans = "Yes"

for a, b in ab:

    time += a

    if time > b:

        ans = "No"



print(ans)

n = int(eval(input()))
works = []
for i in range(n):
    works.append(list(map(int, input().split())))
works = sorted(works, key=lambda x: x[1])


def ans(works):
    time = 0
    for work in works:
        time += work[0]
        if time > work[1]:
            print("No")
            return
    print("Yes")
    return


ans(works)

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

-works = [] -for i in range(n): -    works.append(list(map(int, input().split()))) -works = sorted(works, key=lambda x: x[1]) - - -def ans(works): -    time = 0 -    for work in works: -        time += work[0] -        if time > work[1]: -            print("No") -            return -    print("Yes") -    return - - -ans(works) +ab = [list(map(int, input().split())) for _ in range(n)] +ab.sort(key=lambda x: x[1]) +time = 0 +ans = "Yes" +for a, b in ab: +    time += a +    if time > b: +        ans = "No" +print(ans)