#include<bits/stdc++.h>
using namespace std;
int n;
int dx,dy,ans;
int x[100005],y[100005],xx[100005],yy[100005];
signed main(){
cin >> n;
for(int i = 1 ; i <= n ; i++){
cin >> x[i] >> y[i] >> xx[i] >> yy[i];
}
cin >> dx >> dy;
ans = -1;
for(int i = 1 ; i <= n ; i++){
if(dx >= x[i] && dx <= x[i] + xx[i] && dy >= y[i] && dy <= yy[i]){
ans = i;
}
}
cout << ans;
return 0;
}
真不知道这怎么wa的.............