#include using namespace std; int main() { int T; cin >> T; for (int i = 0; i < T; i++) { int N, M; cin >> N >> M; vector V(N); for (int j = 0; j < M; j++) { int u, v; cin >> u >> v; u--; v--; V[u]++; V[v]++; } set st; bool ok = false; for (auto v : V) { if (st.count(v)) { ok = true; cout << "Yes\n"; break; } st.insert(v); } if (!ok) { cout << "No\n"; } } }