#P7778. New Equipments
New Equipments
New Equipments
Problem Description
Little Q's factory recently purchased pieces of new equipment, labeled by . There are workers in the factory, labeled by . 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 -th worker to the -th piece of equipment, he will need to pay dollars. Now please for every () find pairs of workers and pieces of equipment, then assign workers to these pieces of equipment, such that the total cost for these workers is minimized.
Input
The first line of the input contains a single integer (), the number of test cases. For each case, the first line of the input contains two integers and (, ), denoting the number of workers and the number of pieces of equipment. Each of the following lines contains three integers and (, , , ), denoting a worker.
Output
For each test case, output a single line containing integers, the -th () of which denoting the minimum possible total cost for 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