T = int(input()) for _ in range(T): N,M = map(int,input().split()) G = [[] for i in range(N)] for _ in range(M): u,v = map(int,input().split()) G[u - 1].append(v - 1) G[v - 1].append(u - 1) cnt = set() for i in range(N): c = len(G[i]) if c in cnt: print("Yes") break cnt.add(c) else: print("No")