var
a:array[0..20000,1..4]of longint;
n,x,y,i,t:longint;
begin
readln(n);//读入有多少张地毯
t:=-1; //如果上面没有地毯输出-1for i:=1to n doread(a[i,1],a[i,2],a[i,3],a[i,4]);
readln(x,y);
for i:=1to n do//判断第i个地毯范围是否包括(x,y)beginif(a[i,1<=x)and(a[i,2<=y)and
(a[i,1]+a[i,3]>=x)and(a[i,2]+a[i,4]>=y)then t:=i;
end;
writeln(t); //输出最上面地毯的编号tend.