#include <bits/stdc++.h>
using namespace std;
const int SIZE = 110;
const double e = 1E-8;
struct cube {
  double x1, x2, y1, y2, m, dx, dy;
} A[SIZE];
inline double _min(double a, double b) { return ((a < b) ? a : b); }
int main() {
  int N;
  double x1, y1, x2, y2;
  cin >> N;
  for (int i = 0; i != N; i++) {
    cin >> x1 >> y1 >> x2 >> y2;
    A[i].x1 = _min(x1, x2);
    A[i].y1 = _min(y1, y2);
    A[i].x2 = x1 + x2 - A[i].x1;
    A[i].y2 = y1 + y2 - A[i].y1;
    A[i].m = (A[i].x2 - A[i].x1) * (A[i].x2 - A[i].x1) * (A[i].x2 - A[i].x1);
    A[i].dx = (A[i].x2 + A[i].x1) * 0.5 * A[i].m;
    A[i].dy = (A[i].y2 + A[i].y1) * 0.5 * A[i].m;
  }
  for (int i = 1; i != N; i++) {
    double X = 0.0, Y = 0.0, M = 0.0;
    for (int j = i; j; j--) {
      X += A[j].dx;
      Y += A[j].dy;
      M += A[j].m;
      if (X / M > A[j - 1].x2 + e || X / M < A[j - 1].x1 - e ||
          Y / M > A[j - 1].y2 + e || Y / M < A[j - 1].y1 - e) {
        cout << i << endl;
        return 0;
      }
    }
  }
  cout << N;
  cout << endl;
  return 0;
}
