There are n independent, indivisible jobs numbered from 1 to n. They are executed one after another in some order with no idle time between them, starting at time t=0. The later a job starts, the longer it takes: if job i starts at time t, its execution takes hi(t)=ait+bi, where 0≤ai≤1 and 0≤bi≤1. Each job therefore advances the clock from t to t+hi(t)=(1+ai)t+bi.
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 n and the coefficients ai, bi 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).
Print the chosen ordering of the jobs as a permutation of 1,…,n, one job number per line. When more than one ordering yields the minimum total execution time, print the lexicographically smallest such ordering.