浙江大学OJ果然难一些,数据更加严格啊!在杭电上写的一些AC的程序在这里就是WA,以后编程一定要多注意细节,细节决定成败。加油!!!
In last winter, there was a big snow storm in South China. The electric system was damaged seriously. Lots of power lines were broken and lots of villages lost contact with the main power grid. The government wants to reconstruct the electric system as soon as possible. So, as a professional programmer, you are asked to write a program to calculate the minimum cost to reconstruct the power lines to make sure there's at least one way between every two villages.
Input
Standard input will contain multiple test cases. The first line of the input is a single integerT (1 <=T <= 50) which is the number of test cases. And it will be followed byT consecutive test cases.
In each test case, the first line contains two positive integers N andE (2 <=N <