#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
const int inf = 1e9;
const ll infll = 1e18;
const int M = 1e9 + 7;
const int N = 4e5;
int main(){
int n, k, m;
scanf("%d%d%d", &n, &k, &m);
int cnt[2] = {0,0}, S = 0;
for (int i = 0; i < n; ++i){
int x, y;
scanf("%d%d", &x, &y);
S += x;
S &= 1;
cnt[x%2 == y%2] = 1;
}
if(cnt[0] != cnt[1]){
if(cnt[0] == 1){
printf("%d\n", ((k&1^S)&m^1) + 1);
}
else{
printf("%d\n", (S != m) + 1);
}
}
else{
printf("%d\n", (k&1^1)+1);
}
}
Copy