n, xlb, xrb = map(int, input().split()) enemies = [] for i in range(n): enemies.append([i+1] + list(map(int, input().split()))) result = [0] * (n+1) beams = [1 if xlb <= x <= xrb else 0 for x in range(1281)] for i, xl, yu, xr, yd in enemies: for x in range(max(0, xl), min(xr, 1280)+1): if beams[x]: result[i] = 1 beams[x] = 0 print("\n".join(map(str, result[1:])))