#include <algorithm>#include <cctype>#include <climits>#include <cmath>#include <cstdio>#include <cstdlib>#include <cstring>#include <iostream>#include <queue>#include <utility>int nextInt()
{
int num = 0;
char c;
bool flag = false;
while ((c = std::getchar()) == ' ' || c == '\r' || c == '\t' || c == '\n');
if (c == '-')
flag = true;
else
num = c - 48;
while (std::isdigit(c = std::getchar()))
num = num * 10 + c - 48;
return (flag ? -1 : 1) * num;
}
int n, x, y, ans = -1;
struct dt
{
int x, y, d1, d2;
} all[100123];
int main()
{
n = nextInt();
for (int i = 1; i <= n; i++)
{
all[i].x = nextInt();
all[i].y = nextInt();
all[i].d1 = nextInt();
all[i].d2 = nextInt();
}
x = nextInt();
y = nextInt();
for(int i = 1; i <= n; i++)
{
int tmpx = all[i].x + all[i].d1;
int tmpy = all[i].y + all[i].d2;
if(x <= tmpx && x >= all[i].x && y <= tmpy && y >= all[i].y)
ans = i;
}
std::cout << ans << std::endl;
#ifdef __EDWARD_EDITstd::cin.get();
std::cin.get();
#endifreturn0;
}