2023-07-17 02:42:23 +08:00
|
|
|
#include<bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
using ll = long long;
|
|
|
|
|
|
|
|
|
|
|
|
void solve()
|
|
|
|
{
|
|
|
|
int n,m,k;
|
|
|
|
cin>>n>>m>>k;
|
|
|
|
int x,y;
|
|
|
|
cin>>x>>y;
|
2023-07-17 02:54:43 +08:00
|
|
|
int vika_color=(x+y)%2;
|
2023-07-17 02:42:23 +08:00
|
|
|
bool caught=false;
|
|
|
|
while(k--)
|
|
|
|
{
|
|
|
|
int p,q;
|
|
|
|
cin>>p>>q;
|
2023-07-17 02:54:43 +08:00
|
|
|
int friend_color=(p+q)%2;
|
|
|
|
if(vika_color==friend_color)
|
2023-07-17 02:42:23 +08:00
|
|
|
{
|
|
|
|
caught=true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(caught) cout<<"NO"<<endl;
|
|
|
|
else cout<<"YES"<<endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
ios_base::sync_with_stdio(false);
|
|
|
|
cin.tie(nullptr);
|
|
|
|
|
|
|
|
int TC = 1;
|
|
|
|
cin >> TC;
|
|
|
|
cin.ignore();
|
|
|
|
while (TC--) solve();
|
|
|
|
}
|