import sys import io, os input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline t = int(input()) for _ in range(t): n, m = map(int, input().split()) ind = [0]*n for i in range(m): a, b = map(int, input().split()) a, b = a-1, b-1 ind[a] += 1 ind[b] += 1 if len(set(ind)) == len(ind): print('No') else: print('Yes')