#include<bits/stdc++.h> #define rint register int usingnamespace std;
inlineintread(){ int a = 0; char c; do { c = getchar(); } while (c>'9' c<'0'); do { a = a * 10 + c - '0'; c = getchar(); } while (c >= '0'&&c <= '9'); return a; }
structINPUT { int i, j, e; }; constint MAXN = 1e5 + 10; INPUT input[MAXN]; map<int, int> mp;
int ufs[MAXN * 2];
voidinit(){ for (rint i = 0; i<MAXN * 2; ++i) { ufs[i] = i; } }
intfind(int x){ return ufs[x] = x == ufs[x] ? x : find(ufs[x]); }
boolsame(int x, int y){ int xx = find(x), yy = find(y); return xx == yy ? true : false; }
voidunite(int x, int y){ int xx = find(x), yy = find(y); ufs[xx] = yy; }
#include<bits/stdc++.h> #define rint register int usingnamespace std;
inlineintread(){ int a = 0; char c; do { c = getchar(); } while (c>'9' c<'0'); do { a = a * 10 + c - '0'; c = getchar(); } while (c >= '0'&&c <= '9'); return a; }