def main(): T = int(input()) for _ in range(T): N,M = map(int,input().split()) G = [[] for _ in range(N)] for i in range(M): u,v = map(int,input().split()) u-=1;v=-1 G[u].append(v) G[v].append(u) s = set([]) for i in range(N): t = len(G[i]) if t in s: print("Yes") break else: s.add(t) else: print("No") if __name__ == '__main__': main()