import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class Main { static Scanner scan = new Scanner(System.in); static PrintWriter pw = new PrintWriter(System.out); static UnionFind union; static int N, Q; public static void main(String[] args) { N = scan.nextInt(); Q = scan.nextInt(); union = new UnionFind(N); for(int i=0; i