#include<bits/stdc++.h>      #define ll long long int   #define ld long double   #define pb push_back   #define fi first   #define se second   #define all(x) x.begin(),x.end()   #define mem(x,y) memset(x,y,sizeof(x))   #define pii pair<int,int>   #define pll pair<ll,ll>   #define INF 1e9+10   #define INFL 1e18   #define mod 1000000007   //#define mod 998244353   #define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);   using namespace std;               ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}   ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}      //cout<< fixed << setprecision(10)   //__builtin_popcountll();   //|_2.4_|=2     int vis[500005];   vector<int>g[500005];      int lev[500005];   int ans[500005];      void bfs(int s)   {    queue<int>q;    q.push(s);    vis[s]=1;    lev[s]=0;        while(!q.empty())    {     int x=q.front();     q.pop();     for(int i=0;i<g[x].size();i++)     {            if(vis[g[x][i]]==0)      {       lev[g[x][i]]=lev[x]+1;       vis[g[x][i]]=1;       q.push(g[x][i]);      }           }         }   }   void dfs(int s)   {    vis[s]=1;    for(auto x:g[s])    {     if(lev[s]>=lev[x])      continue;          dfs(x);        ans[s]=min(ans[s],ans[x]);    }   }         int main(){        fast;    int T=1;    cin>>T;    while(T--)    {     int n,i,j,m;     cin>>n>>m;     vector<pii>v;     for(i=0;i<m;i++)     {      int r,c;      cin>>r>>c;      v.pb({c,r});     }     sort(all(v));     int l=0,r;     if(m%2==1)     {      cout<< NO n ;      continue;     }     for(i=0;i+1<m;i+=2)     {      if(v[i].fi==v[i+1].fi)      {       continue;         }      else      {       if(i+2<m&&v[i+1].fi==v[i+2].fi)       {        l=1;        break;       }       if((v[i].se==v[i+1].se&&(v[i+1].fi-v[i].fi-1)%2==0)||(v[i].se!=v[i+1].se&&(v[i+1].fi-v[i].fi-1)%2==1))       {        continue;             }       else       {        l=1;        break;       }         }     }     if(l)     {      cout<< NO n ;     }     else     {      cout<< YES n ;     }                       }   }                     