line=input() line=line.rstrip().split(" ") N=int(line[0]) BL=int(line[1]) BR=int(line[2]) list1=[0]*1280 list1[BL-1:BR]=[1]*(BR-BL+1) #print(len(list1)) list2=[] for i in range(N): line=input() line=line.rstrip().split(" ") list2.append([int(line[3]),i+1,int(line[0]),int(line[2])]) list2.sort(reverse=True) #print(list2) list3=[] for j in range(N): if list2[j][2]<1: list2[j][2]=1 if list2[j][3]>1280: list2[j][3]=1280 A=list1[list2[j][2]-1:list2[j][3]].count(1) B=list2[j][1] list1[list2[j][2]-1:list2[j][3]]=[0]*(list2[j][3]-list2[j][2]+1) list3.append([B,A]) list3.sort() #print(len(list1)) #print(list2) for k in range(N): if list3[k][1]>=1: print(1) elif list3[k][1]==0: print(0)