#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int n;
  cin >> n;
  long long int a[n], b[n], c[n], d[n], e[n];
  long long int p, q, r, s, ind = 1, i, j, k;
  for (i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i] >> d[i], e[i] = i;
  vector<long long int> w, x, y, z, zz;
  for (i = 0; i < n; i++) {
    p = a[i];
    q = b[i];
    r = c[i];
    s = d[i];
    for (j = 0; j < n; j++) {
      if (j == i) continue;
      if (p < a[j] && q < b[j] && r < c[j]) break;
    }
    if (j == n) {
      w.push_back(a[i]);
      x.push_back(b[i]);
      y.push_back(c[i]);
      z.push_back(d[i]);
      zz.push_back(e[i]);
    }
  }
  j = z[0], k = zz[0] + 1;
  for (i = 1; i < w.size(); i++) {
    if (z[i] < j) {
      k = zz[i] + 1;
      j = z[i];
    }
  }
  cout << k << endl;
}
