#include <bits/stdc++.h>
using namespace std;
struct BRICK {
  int x1, x2, y1, y2;
  double wei;
  double cenx, ceny;
} b[101];
int main() {
  int n, x1, x2, y1, y2;
  int i, j, k;
  double w, cx, cy;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d %d %d %d", &b[i].x1, &b[i].y1, &b[i].x2, &b[i].y2);
    b[i].wei = pow(((b[i].x1 - b[i].x2) * (b[i].x1 - b[i].x2) +
                    (b[i].y1 - b[i].y2) * (b[i].y1 - b[i].y2)) /
                       2.0,
                   1.5);
    b[i].cenx = 0.5 * (b[i].x1 + b[i].x2);
    b[i].ceny = 0.5 * (b[i].y1 + b[i].y2);
  }
  for (i = 2; i <= n; i++) {
    cx = b[i].cenx, cy = b[i].ceny, w = b[i].wei;
    for (j = i - 1; j > 0; j--) {
      if ((cx - b[j].x1) * (cx - b[j].x2) > 0 ||
          (cy - b[j].y1) * (cy - b[j].y2) > 0) {
        break;
      }
      cx = (w * cx + b[j].wei * b[j].cenx) / (w + b[j].wei);
      cy = (w * cy + b[j].wei * b[j].ceny) / (w + b[j].wei);
      w += b[j].wei;
    }
    if (j) break;
  }
  printf("%d\n", i - 1);
  return 0;
}
