template <int maxN> struct DSU {
int p[maxN];
int get( int a ) {
return a == p[a] ? a : (p[a] = get(p[a]));
}
void join( int a, int b ) {
p[get(a)] = get(b);
}
void init( int n ) {
for (int i = 0; i < n; i++)
p[i] = i;
}
};