Shoemaker's Job Order

Order N jobs to minimize the total fine paid while each job waits, using the shortest processing time per fine ratio first, with lexicographically smallest ties.

Medium5GreedySortingInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

A shoemaker has NN jobs ordered by customers waiting in his shop. He works on one job at a time, and job ii takes TiT_i days to finish. TiT_i is an integer with 1Ti10001 \le T_i \le 1000.

For every day that passes before job ii starts, the shoemaker pays a fine of SiS_i cents. SiS_i is an integer with 1Si100001 \le S_i \le 10000. Find the job order that makes the total fine as small as possible.

Once an order is fixed, job ii starts after a delay equal to the sum of the durations of the jobs placed before it. The total fine is the sum, over all jobs, of that delay multiplied by SiS_i.

The shoemaker cannot run two jobs on the same day. After he starts job ii, he cannot work on any other job until job ii is finished.

Input

The first line contains the integer NN with 1N10001 \le N \le 1000.

The ii-th of the next NN lines contains TiT_i and SiS_i, separated by a space.

Output

Print, on one line, the job order that gives the smallest total fine. Each job is written as its input number from 11 to NN, and consecutive numbers are separated by a single space. If several orders reach the smallest total fine, print the lexicographically smallest one.