for i in range(int(input())): n,m = map(int,input().split()) for j in range(m): input() print("Yes" if n != 1 else "No")