#include <bits/stdc++.h>
using namespace std;

typedef long long big;
#define bigvec vector<big>
#define pbb pair<big, big>
#define pii pair<int, int>
#define fe first
#define se second
#define maxheap priority_queue
#define uset unordered_set
#define umap unordered_map
#define fr(i, j) for(big i = 0; i < j; i++)
#define revfr(i, j) for(big i = j - 1; i >= 0; i--)
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL)
#define debug(text) if(do_debug) {cout << text << endl;}

const big mod = 1000000007;
const big infinity = 1000000000000000000;
bool do_debug = false;


void rob_santa() {

	string wasted;
	getline(cin, wasted);

	int n_col, n_blocked;
	cin >> n_col >> n_blocked;

	vector<pii> blocked (n_blocked);

	for(int i = 0; i < n_blocked; i++) {

		cin >> blocked[i].se >> blocked[i].fe;
	}

	if(n_blocked == 1) {

		cout << "no" << endl;
		return;
	}

	sort(blocked.begin(), blocked.end());


	int i = 0;

	for(; i < n_blocked - 1; i++) {

		int x = blocked[i].fe;
		int y = blocked[i].se;
		//cout << x << ", " << y << endl;
		int next_x = blocked[i + 1].fe;
		int next_y = blocked[i + 1].se;

		if(blocked[i].fe == blocked[i + 1].fe) {

			i++;
			continue;
		}

		if(i + 2 < n_blocked && blocked[i + 1].fe == blocked[i + 2].fe) {

			cout << "no" << endl;
			return;
		}


		if(next_y == y) {

			if(next_x - x - 1 == 0) {

				i++;
				continue;

			} else if((next_x - x - 1) % 2 == 0){

				i++;
				continue;

			} else {

				cout << "no" << endl;
				return;
			}

		} else {

			if((next_x - x - 1) % 2 == 1) {

				i++;
				continue;

			} else {

				cout << "no" << endl;
				return;
			}
		}
	}

	//cout << i << endl;

	if(i >= n_blocked) {

		cout << "yes" << endl;

	} else {

		cout << "no" << endl;
	}
}


int main() {
	
	speed;

	int q;
	cin >> q;

	while(q-- > 0) {

		rob_santa();
	}

	return 0;
}