Dominos Pizza has hungry customers waiting in queue. Each unique order ,i, is placed by a customer at time x[i], and the order takes y[i] units of time to complete.
You have information of all n orders, Find the order in which all customers will receive their pizza and print it. If two or more orders are completed at same time then sort them by non decreasing order number.
Input:
The first line contains a single integer T, denoting the number of testcases.
The first line of each test case contains a single integer n, denoting the total no orders.
Each of the subsequent lines contains two space-separated integers describing the respective values of x[i] and y[i] for order i .
Output:
Print n lines containing order numbers describing the sequence in which the customers receive their pizzas. If two or more customers receive their pizzas at the same time, print the smallest order no first.
Constraints:
1<=T<=10
1<=n<=500
1<=i<=n
1<=x[i],y[i]<=10000
Example:
Input:
1
5
4 1
6 2
7 6
8 1
1 3
Output:
5
1
2
4
3
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.
bruceewayne | 192 |
manvirag982 | 178 |
theAwesome | 168 |
shivam123ahuja | 167 |
Core_Ka_Bachha | 160 |
mr_kksparrow | 433 |
manvirag982 | 394 |
TheHandle | 282 |
rajupraaa1234 | 276 |
Exception_404 | 268 |
blackshadows | 5331 |
Ibrahim Nash | 5219 |
akhayrutdinov | 5111 |
mb1973 | 4929 |
Quandray | 4567 |