#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 
int main() {
    int t;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        vector<pair<int,int>> v;
        int x,y;
        for(int i=0;i<m;i++)
        {
            cin>>x>>y;
            v.push_back({x,y});
        }
        if(m%2!=0)
        {
            cout<<"NO\n";
            continue;
        }
        sort(v.begin(),v.end(),sortbysec);
        for(int i=1;i<m;i++)
        {
            if(v[i].second==v[i-1].second)
            {
                if((i)%2==0)
                {
                    cout<<"NO\n";
                    goto b;
                }
                else
                {
                    v.erase(v.begin()+i-1);
                    v.erase(v.begin()+i-1);
                    m-=2;
                    i--;
                    
                }
            }
        }
        for(int i=1;i<m;i+=2)
        {
            if(v[i].first==v[i-1].first)
            {
                if((v[i].second-v[i-1].second)%2==0)
                {
                    cout<<"NO";
                    goto b;
                }
            }
            else
            {
                if((v[i].second-v[i-1].second)%2!=0)
                {
                    cout<<"NO";
                    goto b;
                }
            }
        }
        cout<<"YES";
        b :
        cout<<"\n";
    }
	// your code goes here
	return 0;
}
