#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <utility>
#include <string>
#include <cmath>



using namespace std;

struct tacka
{
    int x,y;
    int indeks;
};

bool uporedi(tacka A, tacka B)
{
   if (A.x == B.x) return A.y < B.y;
   return A.x < B.x;
}

bool gore(tacka A, tacka B)
{
     return A.y < B.y;
}

int n,i,k; tacka a[5005]; int redosled[5005];

int main()
{
    FILE *fin, *fout;
    fin = fopen("flojd.in", "r");
    fout = fopen("flojd.out", "w");
    fscanf(fin,"%d", &n);
    for (i = 0; i < n; i++) 
    {
        fscanf(fin,"%d%d", &(a[i].x), &(a[i].y));
        a[i].indeks = i + 1;
    }
    
    sort(a, a + n, uporedi);
    //for (i = 0; i < n; i++) printf("%d %d\n", (a[i].x), (a[i].y));
    k = 0;
    redosled[0] = a[0].indeks;
    i = 1; bool sol = false;
    bool smer = true;
    while (i < n)
    {
       //printf("kordinate,indeks: %d %d %d\n", a[i].x, a[i].y, a[i].indeks);
       bool p = gore(a[i-1], a[i]);
       if (p && smer)
       {
          redosled[i] = a[i].indeks;
       }
       else if (!p && !smer)
       {
           redosled[i] = a[i].indeks;
       }
       else
       {
           //printf("Menjam: %d %d\n", a[i].indeks, a[i-1].indeks);
           redosled[i] = a[i].indeks;
           int pom = redosled[i];
           redosled[i] = redosled[i-1];
           redosled[i-1] = pom;
           tacka t = a[i];
           a[i] = a[i-1];
           a[i-1] = t;
       }
       smer = !smer;
       i++;
      // system("pause");
       
    }
    for (i = 0; i < n; i++) fprintf(fout,"%d\n", redosled[i]);

    
    
    
    //system("pause");
    return 0;
}
