King of Hot Pot

아직 제출이 없습니다시간 제한4초메모리 제한512 MB

문제

Little Q is enjoying hot pot together with Tangjz. There are nn dishes of meat in the boiling water, labeled by 1,2,,n1,2,\dots,n. The ii-th dish of meat will be ready at moment a_ia\_i, and it will take Little Q b_ib\_i units of time to fully eat it. Little Q can start eating dish ii at any moment ta_it \geq a\_i, and then he has to eat it until moment t+b_it + b\_i. Little Q can't be eating more than one dish of meat at the same time.

Little Q is called "King of Hot Pot", and he wants to show off before Tangjz by fully eating kk dishes of meat as soon as possible. The timer starts at moment 00. Please write a program to help Little Q, for each kk independently (1kn1 \leq k \leq n), find kk dishes of meat and the order to eat them such that the total time before he fully eats kk dishes is minimized. Note that any waiting time is also included in the answer.

입력

The first line contains a single integer TT (1T10,0001 \leq T \leq 10\\,000), the number of test cases. For each test case:

The first line contains an integer nn (1n300,0001 \leq n \leq 300\\,000) denoting the number of dishes of meat.

Each of the following nn lines contains two integers a_ia\_i and b_ib\_i (1a_i,b_i1091 \leq a\_i, b\_i \leq 10^9) describing a dish of meat.

It is guaranteed that the sum of all nn is at most 1,000,0001\\,000\\,000.

출력

For each test case, output a single line containing nn integers, the kk-th (1kn1 \leq k \leq n) of which is the minimum total time before Little Q can fully eat kk dishes of meat.