#include #include #include #include #include #include #define N 10001 using namespace std; int head[N],num,dfs[N],low[N],n,m,idx,bridge[N],bum; struct edge { int st,ed,next; }E[N*20]; void addedge(int x,int y) { E[num].st=x; E[num].ed=y; E[num].next=head[x]; head[x]=num++; } int cmp(const void *a,const void *b) { return *(int *)a-*(int *)b; } void Tarjan(int u,int father) { int i,v; low[u]=dfs[u]=idx++; for(i=head[u];i!=-1;i=E[i].next) { v=E[i].ed; if(v==father)continue; if(dfs[v]==-1) { Tarjan(v,u); low[u]=low[u]>low[v] low[v]:low[u]; if(low[v]>dfs[u])//桥 { bridge[bum++]=i; } } else low[u]=low[u]>dfs[v] dfs[v]:low[u]; } } int main() { int i,x,y,j,t,sum; char str[2][200]; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&m); memset(head,-1,sizeof(head)); num=0;sum=1; mapmp; mapmmp; for(i=0;i