/* -*- coding: utf-8 -*- * * 1563.cc: No.1563 Same Degree - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 200000; /* typedef */ /* global variables */ int dgs[MAX_N], cs[MAX_N]; /* subroutines */ /* main */ int main() { int tn; scanf("%d", &tn); while (tn--) { int n, m; scanf("%d%d", &n, &m); fill(dgs, dgs + n, 0); for (int i = 0; i < m; i++) { int u, v; scanf("%d%d", &u, &v); u--, v--; dgs[u]++, dgs[v]++; } bool ok = false; fill(cs, cs + n, 0); for (int i = 0; i < n; i++) if (++cs[dgs[i]] > 1) { ok = true; break; } if (ok) puts("Yes"); else puts("No"); } return 0; }