#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
const int N = 2e5+10;
int T, n, m, cnt;
int relation[N], cha[N], dp[N][3];
struct co
{
    int x, y;
}a[N];
bool cmp(co x, co y)
{
    if (x.y == y.y) return x.x < y.x;
    return x.y < y.y;
}
void sol()
{
    cin >> n >> m;
    for (int i = 1; i <= m; i++) cin >> a[i].x >> a[i].y;
    sort(a+1, a+m+1, cmp);
    for (int i = 1; i <= m; i++) dp[i][0] = dp[i][1] = 0;
    dp[1][0] = 1;
    for (int i = 2; i <= m; i++)
    {
        if (a[i].x != a[i-1].x) relation[i-1] = 1;
        else relation[i-1] = 0;
        cha[i-1] = a[i].y - a[i-1].y;
    }
    for (int i = 2; i <= m; i++)
    {
        if (relation[i-1] == 0 && cha[i-1] % 2)
        {
            dp[i][0] = dp[i-1][1];
            dp[i][1] = dp[i-1][0];
        }
        if (relation[i-1] == 0 && cha[i-1] % 2 == 0)
        {
            dp[i][0] = dp[i-1][1];
            dp[i][1] = 0;
        }
        if (relation[i-1] == 1 && cha[i-1] % 2)
        {
            dp[i][0] = dp[i-1][1];
            dp[i][1] = 0;
        }
        if (relation[i-1] == 1 && cha[i-1] % 2 == 0)
        {
            dp[i][0] = dp[i-1][1];
            dp[i][1] = dp[i-1][0];
        }
        if (!cha[i-1])
        {
            dp[i-1][0] = dp[i][0] = 0;
        }
    }
    if (dp[m][1] == 0) cout << "NO" << '\n';
    else cout << "YES" << '\n';
}
int main()
{
    cin >> T;
    while (T--) sol();
    return 0;
}