t = int(input()) for i in range(t): n, m = map(int, input().split()) g = [0] * n for i in range(m): u, v = map(int, input().split()) g[u-1] += 1 g[v-1] += 1 g.sort() for i in range(n-1): if g[i] == g[i+1]: print("Yes") break else: print("No")