#include <bits/stdc++.h>
#define ll long long
using namespace std;
bool help(vector<pair<ll,ll>> &arr,int m,int start){
    
    bool f=true;
    if((m-start+1)%2){
        f=false;
    }else{
        for(int i=start;i<m;i+=2){
            if(arr[i].first!=arr[i+1].first){
                ll distt=arr[i+1].first-arr[i].first-1;
                ll distt2=abs(arr[i+1].second-arr[i].second);
                if(distt2!=distt%2){
                    f=false;
                    break;
                }
            }
        }
    }
    return f;
}
int main() {
    ll t;
    cin>>t;
    while(t--){
        ll n,m;
        cin>>n>>m;
        vector<pair<ll,ll>> arr(m);
        for(int i=0;i<m;i++){
            cin>>arr[i].second>>arr[i].first;
        }
        sort(arr.begin(),arr.end());
        
        bool f=true;
        int start=0;
        for(int i=1;i<m;i++){
            if(arr[i].first==arr[i-1].first){
                f=f&&help(arr,i-2,start);
                start=i+1;
            }
        }
        f=f&&help(arr,m-1,start);
        if(f){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }
    
  return 0;
}
