#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[10000],b[10000],x[10000],y[10000],num,floor[10000][10000],m,n;
cin>>num;
for (int i=1;i<=num;i++)
{
cin>>a[i]>>b[i]>>x[i]>>y[i];
}
cin>>m>>n;
for (int i=1;i<=n;i++)
{
for(int j=a[i];j<=a[i]+x[i];j++){
for (int k=b[i];k<=b[i]+y[i];k++)
{
floor[j][k]=i;
}
}
}
if (floor[m][n]==0) cout<<-1;
else cout<<floor[m][n];
return 0;
}
结果50分,实在不知道哪里出问题了······