#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int res = 1;
  int X[n][2], Y[n][2];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 2; ++j) scanf("%d%d", &X[i][j], &Y[i][j]);
    sort(X[i], X[i] + 2);
    sort(Y[i], Y[i] + 2);
  }
  for (int i = n - 1; i >= 0; --i) {
    bool overall = 1;
    for (int k = i; overall && k >= 0; --k) {
      bool ok = 1;
      double cx = 0;
      double cy = 0;
      long long V = 0;
      for (int j = k; ok && j; --j) {
        double cgx = .5 * (X[j][1] - X[j][0]) + X[j][0];
        double cgy = .5 * (X[j][1] - X[j][0]) + Y[j][0];
        long long Vg = (X[j][1] - X[j][0]);
        Vg *= Vg * Vg;
        cx = (V * cx + Vg * cgx) / (V + Vg);
        cy = (V * cy + Vg * cgy) / (V + Vg);
        V += Vg;
        if (cx > X[j - 1][1] + 1e-9 || cx + 1e-9 < X[j - 1][0]) ok = 0;
        if (cy > Y[j - 1][1] + 1e-9 || cy + 1e-9 < Y[j - 1][0]) ok = 0;
      }
      overall &= ok;
    }
    if (overall) {
      res = i + 1;
      break;
    }
  }
  printf("%d\n", res);
  return 0;
}
