#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PI 3.14159265
#define fast ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
typedef pair<ll,ll> pli;
typedef pair<int,int> pii;
typedef pair<ld,ld> pld;
ll MOD=1000000007 ;
ll MX=1000000000000000;
ll n;
ll k,m;
int main()
{
fast;
//freopen("input.txt","r",stdin);
cin>>n>>k>>m;
ll x,y;
ll t1=0;
ll t2=0;
ll sum=0;
for(int i=1;i<=n;i++)
{
cin>>x>>y;
x=x%2;
y=y%2;
sum+=x;
if((x+y)%2==0)
{
t1++;
}
else
{
t2++;
}
}
sum=sum%2;
ll res;
if(t2==0)
{
if(sum==m)
{
res=1;
}
else
{
res=2;
}
}
else if(t1==0)
{
if(sum==m)
{
if(k%2==0)
res=1;
else
res=2;
}
else
{
if(k%2==1)
res=1;
else
res=2;
}
}
else
{
if(k%2==0)
res=2;
else
res=2;
}
cout<<res<<endl;
return 0;
}
Copy