#include #include using namespace std; typedef long long ll; vector uf[500010]; ll w[500010] = {},par[500010],parw[500010] = {}; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int i,n,q; cin >> n >> q; for(i=0;i> t >> a >> b; if(t==1){ a--; b--; a = par[a]; b = par[b]; if(a==b) continue; if(uf[a].size()