import java.util.Arrays; import java.util.PriorityQueue; import java.util.Scanner; class DJSet{ int n; int[] upper; public DJSet(int n) { this.n=n; upper=new int[n]; Arrays.fill(upper, -1); } int root(int x) { return upper[x]<0?x:(upper[x]=root(upper[x])); } boolean equiv(int x,int y) { return root(x)==root(y); } void setUnion(int x,int y) { x=root(x);y=root(y); if(x==y)return; if(upper[x]{ int src,dst,cost; public Edge(int src,int dst,int cost) { this.src=src; this.dst=dst; this.cost=cost; } @Override public int compareTo(Edge o) { return cost-o.cost; } } class Main { public static void main(String[] args) { new Main().run(); } void run() { Scanner sc=new Scanner(System.in); int N=sc.nextInt(); int M=sc.nextInt(); int K=sc.nextInt(); DJSet ds=new DJSet(N); PriorityQueue pq=new PriorityQueue<>(); int[] a=new int[M]; int[] b=new int[M]; int[] c=new int[M]; boolean[] fixed=new boolean[M]; for(int i=0;i