for _ in range(int(input())): n, m = map(int, input().split()) a = [0 for _ in range(n)] for i in range(m): v, u = map(int, input().split()) a[v - 1] += 1 a[u - 1] += 1 a.sort() ans = True for i in range(n - 1): if a[i] == a[i + 1]: ans = False break if ans: print("No") else: print("Yes")