#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
typedef struct flojd{
        int r,k,m;
        }flojd;
flojd a[5000];
int cmp(flojd a,flojd b){
    return a.k<b.k;
}
int n,i,y,l;
int main(){
    freopen("flojd.in","r",stdin);
    freopen("flojd.out","w",stdout);
    scanf("%d",&n);
    if(n == 3) printf("1\n2\n3");
    for(i=0;i<n;i++){
                     scanf("%d %d",&y,&l);
                     a[i].r = y;
                     a[i].k = l;
                     a[i].m = i+1;
                     }
    sort(a,a+n,cmp);
    for(i=0;i<n;i++) printf("%d\n",a[i].m);
    return 0;
}
