#P7778. New Equipments

New Equipments

New Equipments

Problem Description

Little Q's factory recently purchased mm pieces of new equipment, labeled by 1,2,,m1,2,\dots,m. There are nn workers in the factory, labeled by 1,2,,n1,2,\dots,n. Each worker can be assigned to no more than one piece of equipment, and no piece of equipment can be assigned to multiple workers. If Little Q assigns the ii-th worker to the jj-th piece of equipment, he will need to pay ai×j2+bi×j+cia_i\times j^2+b_i\times j+c_i dollars. Now please for every kk (1kn1\leq k\leq n) find kk pairs of workers and pieces of equipment, then assign workers to these pieces of equipment, such that the total cost for these kk workers is minimized.

Input

The first line of the input contains a single integer TT (1T101 \leq T \leq 10), the number of test cases. For each case, the first line of the input contains two integers nn and mm (1n501 \leq n \leq 50, nm108n\leq m\leq 10^8), denoting the number of workers and the number of pieces of equipment. Each of the following nn lines contains three integers ai,bia_i,b_i and cic_i (1ai101\leq a_i\leq 10, 108bi108-10^8\leq b_i\leq 10^8, 0ci10160\leq c_i\leq 10^{16}, bi24aicib_i^2\leq 4a_ic_i), denoting a worker.

Output

For each test case, output a single line containing nn integers, the kk-th (1kn1\leq k\leq n) of which denoting the minimum possible total cost for kk pairs of workers and pieces of equipment.

Sample Input

1
3 5
2 3 10
2 -3 10
1 -1 4

Sample Output

4 15 37

Source

2020 Multi-University Training Contest 2