#include #include #include #include #include #include using namespace std; const int penalty = 30000; const int need = 100 * penalty; int main() { int n, g, d; vector< pair > dungeon; cin >> n; for (int i = 1; i <= n; i++) { cin >> g >> d; dungeon.push_back(make_pair(g - d * penalty, i)); } for (int i = n + 1; i <= 6; i++) { dungeon.push_back(make_pair(-1e8, -1)); } sort(dungeon.begin(), dungeon.end(), greater >()); if (dungeon[0].first * 6 < need) { cout << "NO" << endl; return 0; } vector order(6, 1); int point, max_point = 0; for (int i = 0; i < 6; i++) { for (int j = 0; j < 6; j++) { for (int k = 0; k < 6; k++) { for (int x = 0; x < 6; x++) { for (int y = 0; y < 6; y++) { for (int z = 0; z < 6; z++) { int experience = 0; experience += dungeon[i].first; experience += dungeon[j].first; experience += dungeon[k].first; experience += dungeon[x].first; experience += dungeon[y].first; experience += dungeon[z].first; if (experience < need) { continue; } set choice1; choice1.insert(dungeon[i].second); choice1.insert(dungeon[j].second); choice1.insert(dungeon[k].second); choice1.insert(dungeon[x].second); choice1.insert(dungeon[y].second); choice1.insert(dungeon[z].second); vector choice2(n + 1, 0); choice2[dungeon[i].second]++; choice2[dungeon[j].second]++; choice2[dungeon[k].second]++; choice2[dungeon[x].second]++; choice2[dungeon[y].second]++; choice2[dungeon[z].second]++; point = choice1.size() * 10000; point += (6 - *max_element(choice2.begin(), choice2.end())) * 100; point += (i != j); point += (j != k); point += (k != x); point += (x != y); point += (y != z); if (point > max_point) { max_point = point; order[0] = dungeon[i].second; order[1] = dungeon[j].second; order[2] = dungeon[k].second; order[3] = dungeon[x].second; order[4] = dungeon[y].second; order[5] = dungeon[z].second; } }}}}}} cout << "YES" << endl; for (int i = 0; i < 6; i++) { cout << order[i] << endl; } return 0; }