N,L,R=map(int,input().split()) l=[0]*N r=[0]*N d=[0]*N for i in range(N): a,b,c,f=map(int,input().split()) l[i]=a r[i]=c d[i]=f ans=[0]*N for i in range(L,R+1): res=-1 idx=-1 for j in range(N): if l[j]<=i and i<=r[j]: if res