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

struct block{
    int row;
    int col;
};

bool compareblock(block i1, block i2)
{
    return (i1.col < i2.col);
}

void solve()
{
    int n,m;
    cin>>n>>m;
    block pos[m];
    for(int i=0; i<m; ++i)
    {
        cin>>pos[i].row;
        cin>>pos[i].col;
    }
    if(m%2 == 0)
    {
        sort(pos, pos+m, compareblock);
        int flag=1;
        for(int i=1; i<m; ++i)
        {
            flag=(flag+1)%2;
            int value = pos[i].col -pos[i-1].col +pos[i].row -pos[i-1].row;
            if(value<0)
            value=-1*value;
            if(flag==0 && value%2==0)
            {
                flag=3;
                break;
            }
            else if(flag ==1 && pos[i].col==pos[i-1].col)
            {
                flag=3;
                break;
            }
        }
        if(flag==3)
        cout<<"NO"<<endl;
        else
        cout<<"YES"<<endl;
    }
    else
    cout<<"NO"<<endl;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int t;
    cin>>t;
    for(int i=1; i<=t; ++i)
    {
        solve();
    }
    return 0;
}