#include using namespace std; void solve() { size_t n, m; cin >> n >> m; vector> g(n); for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; u--; v--; g[u].push_back(v); g[v].push_back(u); } set st; for (const auto& edges : g) { if (st.find(edges.size()) != st.end()) { puts("Yes"); return; } st.insert(edges.size()); } puts("No"); } int main() { int t; cin >> t; while (t--) { solve(); } return 0; }