11771177 SUSTech Online Judge
Problem 1177 --Spanning Tree 1.0

1177: Spanning Tree 1.0

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 800  Solved: 259
[Submit][Status][Web Board]

Description


Input

Output

Sample Input

1
4 5
1 2 1
1 3 2
1 4 3
3 4 2
2 3 2

Sample Output

5

HINT

Source

[Submit][Status]