#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int a[10010],b[10010];
void swap(int& a,int& b)
{
int temp;
temp=a;
a=b;
b=temp;
}
int main(void)
{
freopen("linstorage.in","r",stdin);
freopen("linstorage.out","w",stdout);
int i,j,n;
cin>>n;
for (i=1;i<=n;i++)
{
cin>>a[i]>>b[i];
b[i]*=a[i];
a[i]=i;
}
for (i=1;i<n;i++)
for (j=1;j<=n-i;j++)
if (b[j]<b[j+1]||(b[j]==b[j+1]&&a[j]>a[j+1]))
{
swap(b[j],b[j+1]);
swap(a[j],a[j+1]);
}
for (i=1;i<=n;i++)
cout<<a[i]<<' ';
cout<<endl;
return(0);
}