import sys

input = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 7)





def main():

    N = int(eval(input()))

    work = []  # due, duration

    for _ in range(N):

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

        work.append((b, -a))

    work.sort()



    now = 0

    for b, a in work:

        now = now - a

        if now > b:

            return "No"

    return "Yes"





if __name__ == "__main__":

    print((main()))
import sys

input = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 7)

N = int(eval(input()))

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

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



ans = "Yes"

t = 0

for a, b in AB:

    t += a

    if t > b:

        ans = "No"

        break



print(ans)
import sys

input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)


def main():
    N = int(eval(input()))
    work = []  # due, duration
    for _ in range(N):
        a, b = list(map(int, input().split()))
        work.append((b, -a))
    work.sort()
    now = 0
    for b, a in work:
        now = now - a
        if now > b:
            return "No"
    return "Yes"


if __name__ == "__main__":
    print((main()))

import sys

input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
ans = "Yes"
t = 0
for a, b in AB:
    t += a
    if t > b:
        ans = "No"
        break
print(ans)

- - -def main(): -    N = int(eval(input())) -    work = []  # due, duration -    for _ in range(N): -        a, b = list(map(int, input().split())) -        work.append((b, -a)) -    work.sort() -    now = 0 -    for b, a in work: -        now = now - a -        if now > b: -            return "No" -    return "Yes" - - -if __name__ == "__main__": -    print((main())) +N = int(eval(input())) +AB = [tuple(map(int, input().split())) for _ in range(N)] +AB.sort(key=lambda x: x[1]) +ans = "Yes" +t = 0 +for a, b in AB: +    t += a +    if t > b: +        ans = "No" +        break +print(ans)