#include <bits/stdc++.h>
using namespace std;
double eps = 1e-8;
int x[105], y[105], a[105];
int main() {
  memset(a, 0, sizeof(a));
  memset(x, 0, sizeof(x));
  memset(y, 0, sizeof(y));
  int n = 0, x1 = 0, y1 = 0, x2 = 0, y2 = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    x[i] = x1 + x2;
    y[i] = y1 + y2;
    a[i] = abs(x1 - x2);
    for (int j = 0; j < i; ++j) {
      double cx = 0, cy = 0, ca = 0;
      for (int k = j + 1; k <= i; ++k) {
        double w = a[k] * a[k] * a[k];
        cx += (double)x[k] * w;
        cy += (double)y[k] * w;
        ca += w;
      }
      cx /= ca;
      cy /= ca;
      if (fabs(cx - x[j]) > a[j] + eps || fabs(cy - y[j]) > a[j] + eps) {
        printf("%d\n", i);
        return 0;
      }
    }
  }
  printf("%d\n", n);
  return 0;
}
