T = int(input()) for _ 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 S = set() for i in range(N): S.add(G[i]) print("Yes") if len(S) != N else print("No")