#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N, xLB, xRB; cin >> N >> xLB >> xRB; xLB += 500, xRB += 500; int M = 3000; vector>> ADD(M), SUB(M); rep(i,N) { int XL, YU, XR, YD; cin >> XL >> YU >> XR >> YD; XL += 500; XR += 500; YU += 500; YD += 500; ADD[XL].push_back({-YD, i}); SUB[XR].push_back({-YD, i}); } set> st; vector ans(N, 0); rep(x,M) { for(auto p : ADD[x]) st.insert(p); if(xLB <= x && x <= xRB && !st.empty()) ans[st.begin()->second] = 1; for(auto p : SUB[x]) st.erase(p); } rep(i,N) cout << ans[i] << "\n"; }