#include typedef struct { int key, id; } data; void merge_sort(data x[], int n) { static data y[100001] = {}; if (n <= 1) return; merge_sort(&(x[0]), n/2); merge_sort(&(x[n/2]), (n+1)/2); int i, p, q; for (i = 0, p = 0, q = n/2; i < n; i++) { if (p >= n/2) y[i] = x[q++]; else if (q >= n) y[i] = x[p++]; else y[i] = (x[p].key < x[q].key)? x[p++]: x[q++]; } for (i = 0; i < n; i++) x[i] = y[i]; } int main() { int i, N, A[100001], B[100001]; data d[100001]; scanf("%d", &N); for (i = 1; i <= N; i++) { scanf("%d %d", &(A[i]), &(B[i])); d[i-1].key = A[i] + B[i]; d[i-1].id = i; } merge_sort(d, N); int j; long long sum = 0; for (i = 0; i < N; i++) { j = d[i].id; if (sum > B[j]) break; sum += A[j]; } if (i == N) printf("Yes\n"); else printf("No\n"); fflush(stdout); return 0; }