#include using namespace std; int main() { int t; cin >> t; vector ans; while (t--) { int n , m; cin >> n >> m; vector c(n , 0); for (int i = 0; i < m; i++) { int a , b; cin >> a >> b; a--; b--; c[a]++; c[b]++; } sort(c.begin() , c.end()); bool ok = false; for (int i = 0; i < n - 1; i++) { if (c[i] == c[i + 1]) { ok = true; break; } } if (ok) ans.push_back("Yes"); else ans.push_back("No"); } for (int i = 0; i < ans.size(); i++) { cout << ans[i] << endl; } return 0; }