import java.io.InputStream; import java.io.PrintWriter; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.PriorityQueue; import java.util.Scanner; import java.util.Set; import java.util.Stack; import java.util.TreeMap; import java.util.TreeSet; import static java.util.Comparator.*; public class Main { public static void main(String[] args) { PrintWriter out = new PrintWriter(System.out); Solver solver = new Solver(System.in, out); solver.solve(); out.close(); } } class Solver { Scanner sc; PrintWriter out; public Solver(InputStream in, PrintWriter out) { sc = new Scanner(in); this.out = out; } // ================================================================== Map> map = new TreeMap<>(Collections.reverseOrder()); public void solve() { int N = Integer.parseInt(sc.next()); int LB = Integer.parseInt(sc.next()); if(LB != 0) LB -= 1; int RB = Integer.parseInt(sc.next()) - 1; int xl, yu, xr, yd; List list; for (int i = 0; i < N; i++) { xl = Integer.parseInt(sc.next()) - 1; yu = Integer.parseInt(sc.next()) - 1; xr = Integer.parseInt(sc.next()) - 1; yd = Integer.parseInt(sc.next()) - 1; list = map.get(yd); if(list == null) { list = new ArrayList<>(); map.put(yd, list); } list.add(new PP(i, xl, xr)); } int[] BBB = new int[2000]; for (int i = LB; i <= RB; i++) BBB[i] = 1; boolean f; int[] ans = new int[N]; for (int key : map.keySet()) { list = map.get(key); for(PP pp : list) { xl = pp.xl; xr = pp.xr; f = false; // out.println("チェック  yd = " + key + " xl = " + xl + " xr = " + xr); for (int i = xl; i <= xr; i++) { if(i < 0 || i >= 1280) continue; // out.println(" BBB[" + i + "] = " + BBB[i]); if(BBB[i] == 1) f = true; BBB[i] = 0; } // out.println("結果 no = " + pp.no + " f = " + f); if(f) ans[pp.no] = 1; } } for (int i = 0; i < N; i++) out.println(ans[i]); } // Set に入れるなら PPKEY を使う! class PP{ public int no, xl, xr; public PP(int no, int xl, int xr) { this.no = no; this.xl = xl; this.xr = xr; } } }