import sys from operator import itemgetter N, xLB, xRB = map(int, input().split()) enemies = [(i, *map(int, l.split())) for i, l in enumerate(sys.stdin.readlines(), start=1)] enemies.sort(key=itemgetter(4), reverse=True) 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:])))