import java.math.BigInteger;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		
		final int xLB = sc.nextInt();
		final int xRB = sc.nextInt();
		final int SIZE = 1280;
		
		int[] low_id = new int[SIZE + 1 + SIZE + SIZE];
		int[] low_height = new int[SIZE + 1 + SIZE + SIZE];
		Arrays.fill(low_id, -1);
		Arrays.fill(low_height, Integer.MIN_VALUE);
		
		for(int i = 0; i < N; i++) {
			final int xl = sc.nextInt() + SIZE;
			final int yu = sc.nextInt();
			final int xr = sc.nextInt() + SIZE;
			final int yd = sc.nextInt();
			
			for(int x = xl; x <= xr; x++) {
				if(low_height[x] < yd) {
					low_height[x] = yd;
					low_id[x] = i;
				}
			}
		}
		
		
		boolean[] hitted = new boolean[N];
		for(int x = SIZE + xLB; x <= SIZE + xRB; x++) {
			if(low_id[x] >= 0) { hitted[low_id[x]] = true; } 
		}
		
		for(int i = 0; i < N; i++) {
			System.out.println(hitted[i] ? 1 : 0);
		}
	}
}