import java.util.*; import java.io.*; import java.math.*; import java.util.stream.Stream; public class Main{ /* 入出力 */ static BufferedReader buff = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter output = new PrintWriter(System.out); static Scanner sc = new Scanner(System.in); /* 定数 */ static final int [] y4 = {0,1,0,-1}; static final int [] x4 = {1,0,-1,0}; static final int INF1 = Integer.MAX_VALUE; static final long INF2 = Long.MAX_VALUE; static final long MOD1 = (long)1e9+7; static final long MOD2 = 998244353; /* Main */ public static void main(String[] args) throws IOException{ int T = sc.nextInt(); while(T-->0) { int n = sc.nextInt(); int m = sc.nextInt(); int same = 0; int [] degree = new int[n]; int [] count = new int[n]; while(m-->0) { int u = sc.nextInt(); int v = sc.nextInt(); u--;v--; if(degree[u] > 0) { count[degree[u]]--; if(count[degree[u]] <= 1) same--; } if(degree[v] > 0) { count[degree[v]]--; if(count[degree[v]] <= 1) same--; } degree[u]++; degree[v]++; count[degree[u]]++; count[degree[v]]++; if(count[degree[u]] > 1) same++; if(count[degree[v]] > 1) same++; } if(same >= 1) output.println("Yes"); else output.print("No"); } output.flush(); } }