#pragma GCC optimize(3) #include #define MAXN 100005 #define MAXM 200005 #define INF 1000000000 #define MOD 1000000007 #define F first #define S second using namespace std; typedef pair P; int T,n,m,k; vector G[MAXN]; vector dis; struct edge{int u,v,id,cost;}; int cnt; bool cmp1(edge x,edge y) { return x.costy.cost; } int p[MAXN],r[MAXN]; void init(int n) { for(int i=1;i<=n;i++) { p[i]=i; r[i]=0; } } int find(int x) { if(p[x]==x) return x; else return p[x]=find(p[x]); } void unite(int x,int y) { x=find(x); y=find(y); if(x==y) return; cnt++; if(r[x] E; void kruskal(bool can[]) { init(n); cnt=0; for(auto e:E) { if(!same(e.u,e.v)) unite(e.u,e.v); if(cnt>=k) can[e.id]=true; } } set s; bool can1[MAXM],can2[MAXM]; int main() { scanf("%d",&T); while(T--) { memset(can1,false,sizeof(can1)); memset(can2,false,sizeof(can2)); E.clear(); s.clear(); scanf("%d%d",&n,&m); k=n/2; for(int i=0;i