import numpy as np

# 締切が早いものから処理

N = int(eval(input()))

AB = np.array([[int(x) for x in input().split()] for _ in range(N)])

A = AB[:,0]

B = AB[:,1]

idx = B.argsort()

A = A[idx]

B = B[idx]

np.cumsum(A, out = A)

bl = (A <= B).all()

answer = 'Yes' if bl else 'No'

print(answer)

def main():

    N = int(eval(input()))

    A = []

    for _ in range(N):

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

        A.append((a, b))



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

    time = 0

    for a, b in A:

        time += a

        if time > b:

            return 'No'



    return 'Yes'



if __name__ == '__main__':

    print((main()))

import numpy as np

# 締切が早いものから処理
N = int(eval(input()))
AB = np.array([[int(x) for x in input().split()] for _ in range(N)])
A = AB[:, 0]
B = AB[:, 1]
idx = B.argsort()
A = A[idx]
B = B[idx]
np.cumsum(A, out=A)
bl = (A <= B).all()
answer = "Yes" if bl else "No"
print(answer)

def main():
    N = int(eval(input()))
    A = []
    for _ in range(N):
        a, b = list(map(int, input().split()))
        A.append((a, b))
    A = sorted(A, key=lambda x: x[1])
    time = 0
    for a, b in A:
        time += a
        if time > b:
            return "No"
    return "Yes"


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

-import numpy as np +def main(): +    N = int(eval(input())) +    A = [] +    for _ in range(N): +        a, b = list(map(int, input().split())) +        A.append((a, b)) +    A = sorted(A, key=lambda x: x[1]) +    time = 0 +    for a, b in A: +        time += a +        if time > b: +            return "No" +    return "Yes" -# 締切が早いものから処理 -N = int(eval(input())) -AB = np.array([[int(x) for x in input().split()] for _ in range(N)]) -A = AB[:, 0] -B = AB[:, 1] -idx = B.argsort() -A = A[idx] -B = B[idx] -np.cumsum(A, out=A) -bl = (A <= B).all() -answer = "Yes" if bl else "No" -print(answer) + +if __name__ == "__main__": +    print((main()))