t = int(input()) for _ in range(t): n, m = map(int, input().split()) V = [0 for _ in range(n)] for _ in range(m): u, v = map(int, input().split()) V[u - 1] += 1 V[v - 1] += 1 seen = set() flag = False for i in range(n): if V[i] in seen: flag = True break seen.add(V[i]) if flag: print("Yes") else: print("No")