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