#include using namespace std; int main(){ int T; cin >> T; for (int i = 0; i < T; i++){ int N, M; cin >> N >> M; vector d(N, 0); for (int j = 0; j < M; j++){ int u, v; cin >> u >> v; u--; v--; d[u]++; d[v]++; } vector used(N + 1, false); bool ok = false; for (int j = 0; j < N; j++){ if (used[d[j]]){ ok = true; } used[d[j]] = true; } if (ok){ cout << "Yes" << endl; } else { cout << "No" << endl; } } }