#include using namespace std; int main() { int n,g,d,ans = 0; cin >> n; for(int i = 0; i < n; i++){ cin >> g >> d; if(500000 <= g - 30000*d) ans = i + 1; } if(ans){ cout << "YES" << endl; for(int i = 0; i < 6; i++) cout << ans << endl; }else{ cout << "NO" << endl; } return 0; }