#include<iostream> #include<algorithm> using namespace std; typedef long long ll; const int Max = 1e6 + 5; struct node { int u, v, w; node(int a=0, int b=0, int c=0) { u = a, v = b, w = c; } bool operator <(node& a) { return w < a.w; } }; node lst[Max]; int f[Max]; int find(...