#include <bits/stdc++.h>
using namespace std;
const int N = 105;
struct node {
  int x1, x2, y1, y2;
  double wei;
  double cenx, ceny;
} b[N];
int main() {
  int n, i, j;
  double cx, cy, w;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> b[i].x1 >> b[i].y1 >> b[i].x2 >> b[i].y2;
    b[i].wei = pow(abs(b[i].x2 - b[i].x1), 3);
    b[i].cenx = (b[i].x1 + b[i].x2) * 0.5;
    b[i].ceny = (b[i].y1 + b[i].y2) * 0.5;
  }
  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;
  }
  cout << i - 1 << endl;
  return 0;
}
