#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define x first
#define y second
#define sz(u) (int)(u.size())
#define ld long double
#define all(u) u.begin(),u.end()
using namespace std;
int main()
{
ios::sync_with_stdio(0); cin.tie(0);
int n,k,m; cin>>n>>k>>m;
ll init=0;
bool is=0;
bool is2=0;
for(int i=0;i<n;i++){
ll x,y; cin>>x>>y;
if(x%2!=y%2) is=1;
else is2=1;
init+=x;
init%=2;
}
if(is==0){
cout<<int(init!=m)+1<<endl;
return 0;
}
if(is2==0){
int end=(init+k)%2;
cout<<(end!=m)+1<<endl;
return 0;
}
if(k%2==1) cout<<1<<endl;
else cout<<2<<endl;
return 0;
}
Copy