#440. Road Discount

Road Discount

Description

There are nn cities in Byteland, labeled by 11 to nn. The Transport Construction Authority of Byteland is planning to construct n1n-1 bidirectional roads among these cities such that every pair of different cities are connected by these roads directly or indirectly.

The engineering company has offered mm possible candidate roads to construct. The ii-th candidate road will cost cic_i dollars, and if it is finally constructed, there will be a road connecting the uiu_i-th city and the viv_i-th city directly. Fortunately, each road has its discounted price, the ii-th of which is did_i.

The Transport Construction Authority of Byteland can buy at most kk roads at their discounted prices. Please write a program to help the Transport Construction Authority find the cheapest solution for k=0,1,2,,n1k=0,1,2,\dots,n-1.

Format

Input

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

The first line contains two integers nn and mm (2n10002 \leq n \leq 1\,000, n1m200000n-1\leq m\leq 200\,000), denoting the number of cities and the number of candidate roads.

Each of the following mm lines contains four integers ui,vi,ciu_i,v_i,c_i and did_i (1ui,vin1 \leq u_i,v_i \leq n, uiviu_i\neq v_i, 1dici10001\leq d_i\leq c_i\leq 1\,000), describing a candidate road.

Output

For each test case, output nn lines, the ii-th (1in1\leq i\leq n) of which containing an integer, denoting the cheapest total cost to construct n1n-1 roads when k=i1k=i-1.

It is guaranteed that the answer always exists.

Samples

1
5 6
1 2 1 1
2 3 2 1
2 4 3 2
2 5 4 3
1 3 5 3
4 5 6 1
10
7
6
5
5