#include <bits/stdc++.h>

using namespace std;

using ll = long long;

bool used[2000], ans[200];
int xl[200], yu[200], xr[200], yd[200];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, xlb, xrb;
    cin >> n >> xlb >> xrb;
    vector<int> idxs(n);
    for (int i = 0; i < n; i++) {
        cin >> xl[i] >> yu[i] >> xr[i] >> yd[i];
        idxs[i] = i;
    }
    sort(idxs.begin(), idxs.end(), [&](const int& i1, const int& i2){return yd[i1] > yd[i2];});

    for (int i : idxs) {
        for (int j = max(xl[i], xlb); j <= min(xr[i], xrb); j++) {
            if (!used[j]) {
                ans[i] = true;
                used[j] = true;
            }
        }
    }

    for (int i = 0; i < n; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}