#include <bits/stdc++.h>
long n;
double m[105] = {0}, smx[105] = {0}, smy[105] = {0}, sm[105] = {0}, tmp;
struct pp {
  double x, y;
} z[105] = {0};
struct point {
  double x1, x2, y1, y2;
} a[105] = {0};
double addd(double now) { return (now * now * now); }
void change(long i) {
  if (a[i].x1 > a[i].x2) {
    tmp = a[i].x1;
    a[i].x1 = a[i].x2;
    a[i].x2 = tmp;
  }
  if (a[i].y1 > a[i].y2) {
    tmp = a[i].y1;
    a[i].y1 = a[i].y2;
    a[i].y2 = tmp;
  }
}
double determin(double a) {
  if (fabs(a) < 1e-7)
    return (0.0);
  else
    return (a);
}
int main() {
  long i, j, k;
  double nowx, nowy;
  scanf("%ld", &n);
  i = 1;
  scanf("%lf%lf%lf%lf", &a[i].x1, &a[i].y1, &a[i].x2, &a[i].y2);
  change(i);
  z[i].x = (a[i].x1 + a[i].x2) / 2.0;
  z[i].y = (a[i].y1 + a[i].y2) / 2.0;
  m[i] = addd(a[i].x2 - a[i].x1);
  sm[i] = sm[i - 1] + m[i];
  smx[i] = smx[i - 1] + m[i] * z[i].x;
  smy[i] = smy[i - 1] + m[i] * z[i].y;
  for (i++; i <= n; i++) {
    scanf("%lf%lf%lf%lf", &a[i].x1, &a[i].y1, &a[i].x2, &a[i].y2);
    change(i);
    z[i].x = (a[i].x1 + a[i].x2) / 2.0;
    z[i].y = (a[i].y1 + a[i].y2) / 2.0;
    m[i] = addd(a[i].x2 - a[i].x1);
    sm[i] = sm[i - 1] + m[i];
    smx[i] = smx[i - 1] + m[i] * z[i].x;
    smy[i] = smy[i - 1] + m[i] * z[i].y;
    for (k = 1 + 1; k <= i; k++) {
      nowx = (smx[i] - smx[k - 1]) / (sm[i] - sm[k - 1]);
      nowy = (smy[i] - smy[k - 1]) / (sm[i] - sm[k - 1]);
      if (determin(a[k - 1].x1 - nowx) > 0.0 ||
          determin(nowx - a[k - 1].x2) > 0.0 ||
          determin(a[k - 1].y1 - nowy) > 0.0 ||
          determin(nowy - a[k - 1].y2) > 0.0)
        break;
    }
    if (k != i + 1) break;
  }
  printf("%ld\n", i - 1);
  return (0);
}
