import java.util.*; import java.io.*; public class Main { public static void main (String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] first = br.readLine().split(" ", 3); int n = Integer.parseInt(first[0]); TreeSet beam = new TreeSet<>(); for (int i = Integer.parseInt(first[1]); i <= Integer.parseInt(first[2]); i++) { beam.add(i); } Enemy[] enemies = new Enemy[n]; PriorityQueue queue = new PriorityQueue<>(); for (int i = 0; i < n; i++) { String[] line = br.readLine().split(" ", 4); enemies[i] = new Enemy(Integer.parseInt(line[0]), Integer.parseInt(line[1]), Integer.parseInt(line[2])); queue.add(enemies[i]); } while (queue.size() > 0) { Enemy e = queue.poll(); Integer left = beam.floor(e.right); Integer right = beam.ceiling(e.left); if ((left != null && left >= e.left) || (right != null && right <= e.right)) { for (int i = e.left; i <= e.right; i++) { beam.remove(i); } e.check(); } } StringBuilder sb = new StringBuilder(); for (Enemy e : enemies) { if (e.checked()) { sb.append(1); } else { sb.append(0); } sb.append("\n"); } System.out.print(sb); } static class Enemy implements Comparable { int left; int right; int hor; boolean hit; public Enemy(int left, int hor, int right) { this.left = left; this.hor = hor; this.right = right; } public int compareTo(Enemy another) { return - hor + another.hor; } public void check() { hit = true; } public boolean checked() { return hit; } } }