#include<iostream> #include<vector> #include<cmath> #include<algorithm> #include<stack> using namespace std; const int N = 1e6 + 7; class UnionFindSets { public: int father[N]; int n; UnionFindSets(int usize) { n = usize; for (int i = 0; i ...