#include <iostream>
#include <vector>
using namespace std;
const int MAXN = 5e5 + 10;
int fa[MAXN], sz[MAXN];
void init(int n) {
for (int i = 1; i <= n; ++i) {
fa[i] = i;
sz[i] = 1;
}
}
int find(int x) {
if (fa[x] != x) fa[x] = find(fa[x]);
return fa[x];
}
void unite(int x, int y) {
x = find(x), y = find(y);
if (x == y) return;
if (sz[x] < sz[y]) swap(x, y);
fa[y] = x;
sz[x] += sz[y];
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
}