Job Scheduling

No attempts yetTime limit1sMemory limit128 MB

Problem

There are nn independent, indivisible jobs numbered from 11 to nn. They are executed one after another in some order with no idle time between them, starting at time t=0t = 0. The later a job starts, the longer it takes: if job ii starts at time tt, its execution takes hi(t)=ait+bih_i(t) = a_i t + b_i, where 0ai10 \le a_i \le 1 and 0bi10 \le b_i \le 1. Each job therefore advances the clock from tt to t+hi(t)=(1+ai)t+bit + h_i(t) = (1 + a_i)\,t + b_i.

The total execution time is the moment the last job finishes. Your task is to order the jobs so that this total is as small as possible.

Write a program that reads nn and the coefficients aia_i, bib_i of every job, then prints an ordering of the jobs that minimizes the total execution time. If several orderings achieve the minimum total time, print the lexicographically smallest one (compare the sequences of job numbers position by position).

Input

  • The first line contains one integer nn (1n10,000)(1 \le n \le 10{,}000), the number of jobs.
  • Each of the next nn lines contains two nonnegative real numbers aia_i and bib_i (0ai1, 0bi1)(0 \le a_i \le 1,\ 0 \le b_i \le 1), separated by a single space. Each number is written in standard decimal form with exactly six digits after the decimal point. Line ii (of these nn lines) gives the coefficients of job ii.

Output

Print the chosen ordering of the jobs as a permutation of 1,,n1, \dots, n, one job number per line. When more than one ordering yields the minimum total execution time, print the lexicographically smallest such ordering.