You are a cat selling fun algorithm problems. Today, you want to recommend your fun algorithm problems to $$$k$$$ cities.
There are a total of $$$n$$$ cities, each with two parameters $$$a_i$$$ and $$$b_i$$$. Between any two cities $$$i,j$$$ ($$$i\ne j$$$), there is a bidirectional road with a length of $$$\max(a_i + b_j , b_i + a_j)$$$. The cost of a path is defined as the total length of roads between every two adjacent cities along the path.
For $$$k=2,3,\ldots,n$$$, find the minimum cost among all simple paths containing exactly $$$k$$$ distinct cities.
The first line of input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1500$$$) — the number of test cases.
For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 3\cdot 10^3$$$) — the number of cities.
Then $$$n$$$ lines follow, the $$$i$$$-th line contains two integers $$$a_i,b_i$$$ ($$$0 \leq a_i,b_i \leq 10^9$$$) — the parameters of city $$$i$$$.
It is guaranteed that the sum of $$$n^2$$$ over all test cases does not exceed $$$9\cdot 10^6$$$.
For each test case, print $$$n-1$$$ integers in one line. The $$$i$$$-th integer represents the minimum cost when $$$k=i+1$$$.
330 22 13 352 77 56 31 87 58899167687 609615846851467150 45726720931502759 23784096918190644 196992738142090421 475722765409556751 726971942513558832 998277529294328304 434714258
4 9 10 22 34 46 770051069 1655330585 2931719265 3918741472 5033924854 6425541981 7934325514
In the first test case:
In the second test case:
Name |
---|