import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int count = 1;
volunteer[] v = new volunteer[n];
for (int i = 0;i < v.length;i++){
int t = sc.nextInt();
int k = sc.nextInt();
v[i] = new volunteer(count,t,k,t*k);
count++;
}
Arrays.sort(v);
for(int i = 0;i < v.length;i++){
System.out.print(v[i].id+" ");
}
}
}
class volunteer implements Comparable<volunteer> {
int id;
int time;
int k;
int value;
public volunteer(int id, int time, int k, int value) {
this.id = id;
this.time = time;
this.k = k;
this.value = value;
}
@Override
public int compareTo(volunteer o) {
return o.value - this.value;
}
}