#include <bits/stdc++.h>
using namespace std;
int N, i, j, ok = 1, sol;
double X[110][5], Y[110][5], GX[110], GY[110], SUMX, SUMY, gx, gy, V[110], vol;
bool inside(int x, int k) {
  if (GX[x] >= min(X[k][1], X[k][2]) && GX[x] <= max(X[k][1], X[k][2]))
    if (GY[x] >= min(Y[k][1], Y[k][2]) && GY[x] <= max(Y[k][1], Y[k][2]))
      return 1;
  return 0;
}
double volume(double X) { return X * X * X; }
int main() {
  cin >> N;
  for (i = 1; i <= N; i++) {
    cin >> X[i][1] >> Y[i][1] >> X[i][2] >> Y[i][2];
    V[i] = volume(abs(X[i][2] - X[i][1]));
  }
  sol = N;
  for (i = 2; i <= N && ok; i++) {
    vol = 0.0;
    for (j = i; j > 1 && ok; j--) {
      GX[i] = GX[i] * vol + V[j] * (X[j][1] + X[j][2]) / 2.0;
      GY[i] = GY[i] * vol + V[j] * (Y[j][1] + Y[j][2]) / 2.0;
      vol = vol + V[j];
      GX[i] /= vol;
      GY[i] /= vol;
      if (!inside(i, j - 1)) {
        ok = 0;
        sol = i - 1;
      }
    }
  }
  cout << sol;
  return 0;
}
