eolymp
bolt
Try our new interface for solving problems
Problems

Testing System

Testing System

Time limit 3 seconds
Memory limit 128 MiB

Junior programmer Sasha wrote his first testing system. He was so happy to compile it that he decided to invite school friends to his own contest.

But at the end of the contest, it became clear that the system couldn't sort the teams in the results table. Help Sasha implement this sort.

The teams are ordered according to ACM rules:

  • by the number of solved tasks in descending order;

  • if the number of solved problems is equal, sort by the penalty time in ascending order;

  • if all the previous parameters are equal, sort by the team number in ascending order.

Input data

The first line contains the number of teams n~(1 \le n \le 10^5) that take part in the contest. The i-th of the next n lines contains the number of solved problems s~(0 \le s \le 100) and the penalty time t~(0 \le t \le 10^5) for the team with number i.

Output data

Print n numbers — the team numbers in the sorted order.

Examples

Input example #1
5
3 50
5 720
1 7
0 0
8 500
Output example #1
5 2 1 3 4
Source 2012 ЛКШ August Parallel B1 Day 1, Problem B