#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

const int INF=20000000;

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

bool operator <(tacka a, tacka b)
{
    if(a.x<b.x) return true;
    else if(a.x==b.x && a.y<b.y) return true;
    return false;
}

tacka a[5005];
bool obidjen[5005];
tacka rez[5005];
int n;

double getk(tacka a1, tacka a2)
{
    double tmpk;
    /*tmpk=(double)(a2.x-a1.x)/(a2.y-a1.y);
    //if(a1.x>a2.x && a1.y>a2.y) tmpk=(double)(-1)/tmpk;

    if(a1.y>a2.y) tmpk=(double)tmpk*(-1);*/
    if(a1.x<a2.x && a1.y<a2.y)
    {
        tmpk=(double)(a2.y-a1.y)/(a2.x-a1.x);
    }
    else if(a1.x>a2.x && a1.y<a2.y)
    {
        tmpk=(double)(a2.x-a1.x)/(a2.y-a1.y);
        tmpk*=-1;
        tmpk+=INF;
    }
    else if(a1.x>a2.x && a1.y>a2.y)
    {
        tmpk=(double)(a2.x-a1.x)/(a2.y-a1.y);
        tmpk+=INF;
        tmpk*=-1;
    }
    else if(a1.x<a2.x && a1.y>a2.y)
    {
        tmpk=(double)(a2.y-a1.y)/(a2.x-a1.x);
    }
    else if(a1.x==a2.x)
    {
        tmpk=INF;
        if(a1.y>a2.y) tmpk*=-1;
    }
    return tmpk;
}

int main()
{
    freopen("flojd.in", "r", stdin);
    freopen("flojd.out", "w", stdout);
    int i, j;
    int br;
    double k, ktmp;
    tacka tmp, tmp2;
    tmp.x=20000000;
    tmp2.x=20000000;
    scanf("%i", &n);
    k=10000000000;
    for(i=0; i<n; i++)
    {
        scanf("%i %i", &a[i].x, &a[i].y);
        a[i].rb=i;
        tacka tmpprva;
        tmpprva.x=0;
        tmpprva.y=0;
        ktmp=getk(tmpprva, a[i]);
        //printf("Tacke 0 i %i imaju k: ", i+1);
               // cout << ktmp << endl;

            if(ktmp<k)
            {
                k=ktmp;
                tmp=a[i];
            }

    }
    if(n==1)
    {
        printf("1\n");
        return 0;
    }
    swap(a[tmp.rb], a[0]);
    k=-1000000000;
    for(i=1; i<n; i++)
    {
        ktmp=getk(a[0], a[i]);
        //printf("Tacke %i i %i imaju k: ", tmp.rb+1, a[i].rb+1);
            //    cout << ktmp << endl;
        if(ktmp>k)
        {
            k=ktmp;
            tmp2=a[i];
        }
    }
    //swap(a[tmp2.rb], a[1]);
    swap(a[tmp.rb], a[0]);
    rez[0]=a[tmp.rb];
    rez[1]=a[tmp2.rb];
    int curr=tmp2.rb;
    int index;
    int br1=0;
    br=2;
    obidjen[tmp.rb]=true;
    obidjen[tmp2.rb]=true;
    for(i=2; i<n; i++)
    {
        if(br1%2==0)
        {
            int absxdif;
            k=10+INF*3;
            for(j=0; j<n; j++)
            {
                if(j==curr || obidjen[j]) continue;
                ktmp=getk(a[curr], a[j]);
                if(ktmp<k)
                {
                    k=ktmp;
                    index=j;
                    absxdif=abs(a[curr].x-a[j].x);
                }
                else if(ktmp==k)
                {
                    if(abs(a[curr].x-a[j].x)>absxdif)
                    {
                        k=ktmp;
                        index=j;
                        absxdif=abs(a[curr].x-a[j].x);
                    }
                }
                //printf("1Tacke %i i %i imaju k: ", curr+1, j+1);
               // cout << ktmp << endl;
            }
            rez[br]=a[index];
            obidjen[a[index].rb]=true;
            //printf("Izabrana je: %i\n", a[index].rb+1);
            if(rez[br-1].y<rez[br].y)
            {
                swap(rez[br-2], rez[br-1]);
                swap(rez[br-1], rez[br]);
            }
            curr=rez[br].rb;
           // printf("Trenutna je: %i\n", curr+1);
            br++;
        }
        else
        {
            int absxdif;
            k=-10-INF*3;
            for(j=0; j<n; j++)
            {
                if(j==curr || obidjen[j]) continue;
                ktmp=getk(a[curr], a[j]);
                //printf("2Tacke %i i %i imaju k: ", curr+1, j+1);
                //cout << ktmp << endl;
                if(ktmp>k)
                {
                    k=ktmp;
                    index=j;
                    absxdif=abs(a[curr].x-a[j].x);
                }
                else if(ktmp==k)
                {
                    if(abs(a[curr].x-a[j].x)>absxdif)
                    {
                        k=ktmp;
                        index=j;
                        absxdif=abs(a[curr].x-a[j].x);
                    }
                }
            }
            rez[br]=a[index];
            obidjen[a[index].rb]=true;
            //printf("Izabrana je: %i\n", a[index].rb+1);
            if(rez[br-1].y>rez[br].y)
            {
                swap(rez[br-2], rez[br-1]);
                swap(rez[br-1], rez[br]);
                br1++;
            }
            curr=rez[br].rb;
            //printf("Trenutna je: %i\n", curr+1);
            br++;
        }
        //for(j=0; j<br; j++)
          // printf("%i\n", rez[j].rb+1);
        br1++;
    }
    printf("RESENJE:\n");
    for(i=0; i<n; i++)
        printf("%i\n", rez[i].rb+1);
    return 0;
}
/*
double getk(tacka a1, tacka a2)
{
    double tmpk;
    if(a1.y<a2.y)
    {
        if(
        tmpk=(double)(a2.y-a1.y)/(a2.x-a1.x);
    }
    else
    {
        tmpk=(double)(a2.y-a1.y)/(a1.x-a2.x);
    }
    return tmpk;
}
*/
