#include <bits/stdc++.h>
using namespace std;
int n, x1, yy1, x2, y2, x[105], y[105], z[105];
double xx, yy, zz, t, eps = 1e-8;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x1 >> yy1 >> x2 >> y2;
    x[i] = (x1 + x2), y[i] = (yy1 + y2), z[i] = fabs(x2 - x1);
    for (int j = 0; j < i; j++) {
      xx = yy = zz = 0;
      for (int k = j + 1; k <= i; k++) {
        t = z[k] * z[k] * z[k];
        xx += x[k] * t, yy += y[k] * t, zz += t;
      }
      xx /= zz, yy /= zz;
      if (max(fabs(xx - x[j]), fabs(yy - y[j])) > z[j] + eps) {
        cout << i;
        return 0;
      }
    }
  }
  cout << n;
}
