#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<pair<int, int>> v;
int main() {
int n, k, m;
scanf("%d%d%d", &n, &k, &m);
if(k > 3) k = 2 + k%2;
v.resize(3, make_pair(0, 0));
int tot = 0;
for(int i = 0; i < n; i++){
int x, y;
scanf("%d%d", &x, &y);
if(x%2 == 1) tot = 1 - tot;
if(x%2 == 0 && y%2 == 0) continue;
if(x%2 == 1 && y%2 == 1){
v[0] = {x, y};
} else if(x%2 == 1 && y%2 == 0){
v[1] = {x, y};
} else {
v[2] = {x, y};
}
}
if(v[1].first == 0 && v[2].first == 0){
if(m == tot) cout << 1 << endl;
else cout << 2 << endl;
return 0;
}
if(k%2){
cout << 1 << endl;
} else {
cout << 2 << endl;
}
return 0;
}
Copy