#include <bits/stdc++.h>
using namespace std;
void file() {}
const int MN = 1e5 + 1e2;
const int MW = 1e3 + 5;
const int OO = 1e9 + 5;
ifstream fin("input.txt");
ofstream fout("output.txt");
int cube(int a) { return a * a * a; }
int main() {
  int n;
  int x[105][2], y[105][2], m[105];
  int cnt = 1;
  bool f = false;
  int xi = 0, yi = 0, mi = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i][0]), scanf("%d", &y[i][0]), scanf("%d", &x[i][1]),
        scanf("%d", &y[i][1]);
    if (x[i][0] > x[i][1]) swap(x[i][0], x[i][1]);
    if (y[i][0] > y[i][1]) swap(y[i][0], y[i][1]);
    m[i] = cube(x[i][1] - x[i][0]);
  }
  for (int i = 1; i < n; i++) {
    mi = m[i];
    xi = m[i] * (x[i][0] + x[i][1]);
    yi = m[i] * (y[i][0] + y[i][1]);
    for (int j = i - 1; j > -1; j--) {
      if (xi < 2 * x[j][0] * mi || xi > 2 * x[j][1] * mi) {
        cnt = i;
        f = true;
        break;
      }
      if (yi < 2 * y[j][0] * mi || yi > 2 * y[j][1] * mi) {
        cnt = i;
        f = true;
        break;
      }
      mi += m[j];
      xi += m[j] * (x[j][0] + x[j][1]);
      yi += m[j] * (y[j][0] + y[j][1]);
    }
    if (f) break;
  }
  printf("%d", (!f) ? n : cnt);
  return 0;
}
