for _ in range(int(input())): N, M = map(int, input().split()) cnts = [0] * N for i in range(M): U, V = map(int, input().split()) cnts[U - 1] += 1 cnts[V - 1] += 1 isO = False isS = [False] * N for c in cnts: isO |= isS[c] isS[c] = True print("Yes" if isO else "No")