#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; int main() { int N,xLB,xRB; cin >> N >> xLB >> xRB; int X[1281] = {0}; for ( int i = xLB; i <= xRB; i++ ) { X[i] = 1; } vector< pair< pair< int, pair >, int > > V(N); for ( int i = 0; i < N; i++ ) { int a,b,c,d; cin >> a >> b >> c >> d; a = max(a,0); c = min(c,1280); V[i] = make_pair( make_pair( d, make_pair(a,c) ), i ); } sort( V.begin(), V.end(), greater< pair< pair< int, pair >, int > >() ); vector ans(N); for ( int i = 0; i < N; i++ ) { bool death = false; for ( int j = V[i].first.second.first; j <= V[i].first.second.second; j++ ) { if ( X[j] == 1 ) { death = true; } X[j] = 0; } ans[ V[i].second ] = death ? 1 : 0; } for ( int i = 0; i < N; i++ ) { cout << ans[i] << endl; } return 0; }