import java.io.*; import java.util.*; public class Main_yukicoder678 { private static Scanner sc; private static Printer pr; private static void solve() { int n = sc.nextInt(); int xlb = sc.nextInt(); int xrb = sc.nextInt(); List list = new ArrayList<>(n); for (int i = 0; i < n; i++) { int xl = sc.nextInt(); int yu = sc.nextInt(); int xr = sc.nextInt(); int yd = sc.nextInt(); list.add(new Pair(Math.max(0, xl), Math.max(0, yu), xr, yd, i)); } Collections.sort(list); int[] ans = new int[n]; boolean[] w = new boolean[1280 + 1]; Arrays.fill(w, true); for (int i = xlb; i <= xrb; i++) { w[i] = false; } for (int i = list.size() - 1; i >= 0; i--) { Pair e = list.get(i); boolean flag = false; for (int x = e.a; x <= e.c; x++) { if (!w[x]) { flag = true; } w[x] = true; } if (flag) { ans[e.n] = 1; } else { ans[e.n] = 0; } } for (int e : ans) { pr.println(e); } } static class Pair implements Comparable { int a; int b; int c; int d; int n; Pair(int a, int b, int c, int d, int n) { this.a = a; this.b = b; this.c = c; this.d = d; this.n = n; } @Override public int compareTo(Pair o) { if (d == o.d) { return Integer.compare(c, o.c); } return Integer.compare(d, o.d); } } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes())); pr = new Printer(System.out); solve(); // pr.close(); pr.flush(); // sc.close(); } static String INPUT = null; private static class Printer extends PrintWriter { Printer(OutputStream out) { super(out); } } }