#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
struct Rect {
	int l, u, r, d, ind;
	bool operator<(const Rect& right) const {
		return d > right.d;
	}
};
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	int L, R;
	cin >> L >> R;
	vector<Rect> rect(N);
	for (int i = 0; i < N; i++) {
		cin >> rect[i].l >> rect[i].u >> rect[i].r >> rect[i].d;
		rect[i].ind = i;
	}
	sort(rect.begin(), rect.end());
	set<int> ng;
	for (int i = L; i <= R; i++) {
		ng.insert(i);
	}
	vector<int> res(N, 0);
	for (int i = 0; i < N; i++) {
		for (int j = rect[i].l; j <= rect[i].r; j++) {
			if (ng.count(j) == 1) {
				res[rect[i].ind] = 1;
				ng.erase(j);
			}
		}
	}
	for (int i = 0; i < N; i++) {
		cout << res[i] << endl;
	}
}