#include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> #include<algorithm> #include<cmath> using namespace std; inline int read() { int sum=0,p=1;char ch=getchar(); while(!((‘0‘<=ch && ch<=‘9‘) || ch==‘-‘))ch=getchar(); if(ch==‘-‘)p=-1,ch=getchar(); while(‘0‘<=ch && ch<=‘9‘)sum=sum*10+ch-48,ch=getchar(); return sum*p; } struct ditan{ int zxx,zxy,ysx,ysy; }a[10001]; int main() { int n,xx,yy,lx,ly,x,y; n=read(); for(int i=1;i<=n;i++) { xx=read();yy=read();lx=read();ly=read(); a[i].zxx=xx;a[i].zxy=yy;a[i].ysx=xx+lx;a[i].ysy=yy+ly; } x=read();y=read(); for(int i=n;i>=1;i--) { if(a[i].zxx<=x&&a[i].zxy<=y&&a[i].ysx>=x&&a[i].ysy>=y) { cout<<i<<endl; return 0; } } cout<<"-1"<<endl; return 0; }