#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:200000000")
using namespace std;
int ri() {
  int x;
  scanf("%d", &x);
  return x;
}
long long rll() {
  long long x;
  scanf("%lld", &x);
  return x;
}
int x1[111];
int sadqarewg[111];
int x2[111];
int y2[111];
bool check(int n, int idx) {
  for (int i = 0; i < idx; i++) {
    long double curx = 0;
    long double cury = 0;
    long double sum = 0.0;
    for (int j = i + 1; j <= idx; j++) {
      curx += (long double)(x1[j] + x2[j]) / 2.0 *
              (long double)(x2[j] - x1[j]) * (long double)(x2[j] - x1[j]) *
              (long double)(x2[j] - x1[j]);
      cury += (long double)(sadqarewg[j] + y2[j]) / 2.0 *
              (long double)(x2[j] - x1[j]) * (long double)(x2[j] - x1[j]) *
              (long double)(x2[j] - x1[j]);
      sum += (long double)(x2[j] - x1[j]) * (long double)(x2[j] - x1[j]) *
             (long double)(x2[j] - x1[j]);
    }
    curx /= sum;
    cury /= sum;
    if (curx + 1e-9 >= (long double)x1[i] &&
        curx - 1e-9 <= (long double)x2[i] &&
        cury + 1e-9 >= (long double)sadqarewg[i] &&
        cury - 1e-9 <= (long double)y2[i]) {
    } else
      return false;
  }
  return true;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d %d %d", &x1[i], &sadqarewg[i], &x2[i], &y2[i]);
    int max_x = max(x1[i], x2[i]);
    int min_x = min(x1[i], x2[i]);
    int max_y = max(sadqarewg[i], y2[i]);
    int min_y = min(sadqarewg[i], y2[i]);
    x1[i] = min_x;
    x2[i] = max_x;
    sadqarewg[i] = min_y;
    y2[i] = max_y;
  }
  int res = 1;
  for (int i = 1; i < n; i++) {
    if (check(n, i))
      res++;
    else
      break;
  }
  printf("%d", res);
  return 0;
}
