from collections import Counter T = int(input()) for t in range(T): N, M = map(int, input().split()) deg = [0]*N for i in range(M): u, v = map(int, input().split()) deg[u-1] += 1 deg[v-1] += 1 counted = Counter(deg) mx = max(counted.values()) if mx > 1: print('Yes') else: print('No')