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