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]) s.add(t) if len(s) == N: print("No") else: print("Yes") if __name__ == '__main__': main()