#include #include using namespace std; int main() { int N; int K_score = 0; int a[100]; int b[100]; int score[100] = { 0 }; cin >> N; for (int i = 0; i < N;i++) { cin >> a[i] >> b[i]; if (b[i] == 0) { K_score += a[i]; } else { score[b[i] - 1] += a[i]; } } sort(b, b + 100); if (K_score >= b[99]) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0; }