n, xlb, xrb = map(int, input().split()) s = [] for i in range(n): xl, yu , xr, _ = map(int, input().split()) s.append([i+1, yu, xl, xr]) s = sorted(s, key=lambda x:(-x[1], x[0])) l = [0 for _ in range(1281)] ans = [] for i in s: if i[2] < 0: i[2] = 0 if i[3] > 1280: i[3] = 1281 for j in range(i[2], i[3]+1): if l[j-1] == 0: ans.append(i[0]) l[j-1] = i[0] ans = list(set(ans)) for i in range(1, n+1): if i in ans: print(1) else: print(0)