#include<stdio.h> #include<string.h> #define N 2100 int degree[N]; int pre[N];//很长时间没写欧拉回路了忘了判断他是否联通了 int find(int x) { if(x!=pre[x]) pre[x]=find(pre[x]); return pre[x]; } int main() { int t,n,m,i,ans,a,b,aa,bb; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&m); memset(degree,0,sizeof(degree)); for(i=1;i<=n;i++) pre[i]=i; while(m--) { scanf("%d%d",&a,&b); degree[a]++; degree[b]++; aa=find(a); bb=find(b); if(aa!=bb) pre[aa]=bb; } ans=0; for(i=1;i<=n;i++) if(pre[i]==i) ans++; if(ans>1) { printf("No "); continue; } ans=0; for(i=1;i<=n;i++) if(degree[i]%2==1) ans++; if(ans==2||ans==0) printf("Yes "); else printf("No "); } return 0; }