import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np grid = np.zeros((2010,2200),np.int32) N,xL,xR = map(int,readline().split()) for i in range(1,N+1): x1,y1,x2,y2 = map(int,readline().split()) if x1 < 0: x1 = 0 if y1 < 0: y1 = 0 grid[x1:x2+1, y1:y2+1] = i grid = grid[xL:xR+1] for n in range(1,2200): grid[:,n] += (grid[:,n] == 0) * grid[:,n-1] hit = np.zeros(N+1,np.bool) hit[grid[:,-1]] = 1 print('\n'.join((hit[1:] * 1).astype(str)))