#include #include #include #include using namespace std; int t,k,n,m,tp,sum,fa[100005],ans[100005],u,v,w,f1,f2; int get(int k){ if(k==fa[k])return k;return fa[k]=get(fa[k]); } int main(){ scanf("%d",&t); while(t--){ scanf("%d",&n);sum=0;memset(ans,0,sizeof(ans)); for(int i=1;i<=n;++i)fa[i]=i; for(int i=1;i