#include "bits/stdc++.h"
using namespace std;
#define int int64_t
#define ll int64_t
// typedef unsigned int uint;
// typedef long long int ll;
// typedef unsigned long long ull;
typedef long long lli ;
typedef pair<int, int> pii;
typedef pair<lli, lli> pll;
typedef pair<lli, pll> lll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define endl '\n'
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define freopenI freopen("input.txt", "r", stdin);
#define freopenO freopen("output.txt", "w", stdout);
const int INF = 0x3f3f3f3f;
const lli INFLL = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int x, int y) {
return uniform_int_distribution<int>(x, y)(rng);
}
int mul(int a, int b){
return (1ll * a * b) % MOD;
}
int add(int a, int b){
return (1ll * a + b + MOD + MOD) % MOD;
}
int pow_exp(int n, int p){
if(!p) return 1;
if(p&1) return mul(n, pow_exp(n, p-1));
int tmp = pow_exp(n, p/2);
return mul(tmp, tmp);
}
const int MAX = 2e5 + 10;
const int NMAX = 2e5 + 10;
const int MMAX = 2e5 + 10;
const int LOG_MAX = ceil(log2(double(NMAX)));
const int BLOCK = ceil(sqrt(double(NMAX)));
int cnt[NMAX / 10];
set<int> v[27], y[27];
int L [NMAX];
string s, t;
bool ok(int l) {
int cur = -5;
if (L[0] >= l) return 1;
for (int i=0;i<t.size();i++){
auto nxt = v[t[i] - 'a'].upper_bound(cur);
if (nxt == v[t[i] - 'a'].end()) return 0;
cur = *nxt;
if (i+1 < t.size()){
if (L[i + 1] - cur > l) return 1;
}
}
return (s.size() - cur - 1 >= l);
}
int idx = -1;
int32_t main(){
fastIO;
#ifdef LOCAL
freopenI;
freopenO;
#endif
//int t; cin >> t; while(t--){
// aaaa
// bb
// ab
// aaa
// bbb
int n, k, m;
cin >> n >> k >> m;
ll s1 = 0, s2 = 0;
bool nig=0;
for (int i=0;i<n;i++){
int x, y;
cin >> x >> y;
nig |= x % 2 != y % 2;
s1 += x;
s2 += y;
}
if (s1 % 2 == m) {
if (k % 2 == 0 && nig) {
cout << 1 << endl;
return 0;
}
if (k % 2 == 0 && !nig) {
cout << 2 << endl;
return 0;
}
if (k % 2 == 1 && nig) {
cout << 2 << endl;
return 0;
}
if (k % 2 == 1 && !nig) {
cout << 1 << endl;
}
}
// 1 2
else {
if (k % 2 == 0 && nig) {
cout << 2 << endl;
return 0;
}
if (k % 2 == 0 && !nig) {
cout << 1 << endl;
return 0;
}
if (k % 2 == 1 && nig) {
cout << 1 << endl;
return 0;
}
if (k % 2 == 1 && !nig) {
cout << 2 << endl;
}
}
//}
}
/*
arrays sizes
INFLL & 1ll
if its an interactive problem : #define endl '\n'
notes :
*/
Copy