#include <bits/stdc++.h>
using namespace std;
int x1[100];
int ololo[100];
int x2[100];
int y2[100];
int m[100];
int main(void) {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d%d%d", &x1[i], &ololo[i], &x2[i], &y2[i]);
    m[i] = abs(((x1[i] - x2[i]) * (x1[i] - x2[i]) * (x1[i] - x2[i])));
  }
  for (int i = 1; i < n; i++) {
    long long cx = 0;
    long long cy = 0;
    long long sm = 0;
    for (int j = i; j >= 1; j--) {
      cx += (x1[j] + x2[j]) * m[j];
      cy += (ololo[j] + y2[j]) * m[j];
      sm += m[j];
      if ((cx - 2 * sm * x2[j - 1]) * (cx - 2 * sm * x1[j - 1]) > 0 ||
          (cy - 2 * sm * y2[j - 1]) * (cy - 2 * sm * ololo[j - 1]) > 0) {
        printf("%d\n", i);
        return 0;
      }
    }
  }
  printf("%d\n", n);
  return 0;
}
