#include <bits/stdc++.h>
using namespace std;
const int N = 200;
const double eps = 1e-8;
double ww[N];
double aa[N], bb[N], cc[N], dd[N];
int sign(double x, double y) {
  if (x - y < -eps) return -1;
  if (x - y > eps) return 1;
  return 0;
}
int f(int l, int r) {
  double w = 0;
  for (int i = l; i <= r; i++) {
    w += ww[i];
  }
  double x = 0, y = 0;
  for (int i = l; i <= r; i++) {
    x += (aa[i] + cc[i]) / 2 * ww[i] / w;
    y += (bb[i] + dd[i]) / 2 * ww[i] / w;
  }
  if (sign(min(aa[l - 1], cc[l - 1]), x) > 0 ||
      sign(max(aa[l - 1], cc[l - 1]), x) < 0 ||
      sign(min(bb[l - 1], dd[l - 1]), y) > 0 ||
      sign(max(bb[l - 1], dd[l - 1]), y) < 0)
    return 0;
  return 1;
}
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    for (int i = 1; i <= n; i++) {
      scanf("%lf%lf%lf%lf", &aa[i], &bb[i], &cc[i], &dd[i]);
      ww[i] = pow(fabs(aa[i] - cc[i]), 3);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      int flag = 0;
      for (int j = i; j >= 2; j--) {
        if (!f(j, i)) {
          flag = 1;
          break;
        }
      }
      if (!flag)
        ans = i;
      else
        break;
    }
    printf("%d\n", ans);
  }
  return 0;
}
