PROGRAMMING:Construction of minimum spanning tree
The "village to village" project is carried out in a remote area. The goal is to realize rapid transportation between any two villages in the whole area (but there is not necessarily a direct Expressway connection, as long as they can reach each other indirectly through the expressway). Now get the cost of the road to be built, now please write a program to calculate the minimum cost of the whole area.
###Input format:
The first line of input gives the number of villages n (1 ≤ n ≤ 20) and the number of roads m to be built
The next M line corresponds to the cost of building the road between each village. Each line gives three positive integers, which are the number of two villages (from 1 to n), and the cost of the road between the two villages.
###Output format:
Output the road to be built, according to the prim algorithm from the number 1 to get the order, output each road, each line output a road, such as: Road 1 number, road 2 number, cost( Put the small number in the front, the large number in the back, and the comma is the comma in English)
###Input example:
```in
4 6
1 2 1
1 3 4
1 4 1
2 3 3
2 4 2
3 4 5
```
###Output example:
```out
1,2,1
1,4,1
2,3,3
```
answer:If there is no answer, please comment
###Input format:
The first line of input gives the number of villages n (1 ≤ n ≤ 20) and the number of roads m to be built
The next M line corresponds to the cost of building the road between each village. Each line gives three positive integers, which are the number of two villages (from 1 to n), and the cost of the road between the two villages.
###Output format:
Output the road to be built, according to the prim algorithm from the number 1 to get the order, output each road, each line output a road, such as: Road 1 number, road 2 number, cost( Put the small number in the front, the large number in the back, and the comma is the comma in English)
###Input example:
```in
4 6
1 2 1
1 3 4
1 4 1
2 3 3
2 4 2
3 4 5
```
###Output example:
```out
1,2,1
1,4,1
2,3,3
```
answer:If there is no answer, please comment