#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
 
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define trav(a, x) for (auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef tuple<ll, ll, ll> ll3;
typedef vector<int> vi;
typedef vector<pii> vpi;
 
int t, n, m;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	cin >> t;
	while (t--) {
		cin >> n >> m;
		vector<pii> a(m);
		rep(i, 0, m) cin >> a[i].second >> a[i].first;

		if (m % 2 == 1) {
			cout << "NO" << '\n';
			continue;
		}

		sort(all(a));

		bool sol = true;
		for (int i = 1; i < sz(a); i += 2) {
			if (a[i].first == a[i-1].first) continue;
			if (a[i].second == a[i-1].second && (a[i].first - a[i-1].first) % 2 != 1) {
				sol = false;
				break;
			}
			if (a[i].second != a[i-1].second && (a[i].first - a[i-1].first) % 2 == 1) {
				sol = false;
				break;
			}
			if (i + 1 < m && a[i+1].first == a[i].first) {
				sol = false;
				break;
			}
		}

		cout << (sol ? "YES" : "NO") << '\n';
	}
 
	return 0;
}

