#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, i, t1, t2, t3, t4, j;
  cin >> n;
  vector<vector<long long>> specs(n, vector<long long>(4, 0));
  for (i = 0; i < n; i++) {
    cin >> t1 >> t2 >> t3 >> t4;
    specs[i][0] = t1;
    specs[i][1] = t2;
    specs[i][2] = t3;
    specs[i][3] = t4;
  }
  set<long long> outDated;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (specs[i][0] < specs[j][0] && specs[i][1] < specs[j][1] &&
          specs[i][2] < specs[j][2]) {
        outDated.insert(i);
      }
    }
  }
  long long minCost = INT_MAX;
  long long bestLaptop = -1;
  for (i = 0; i < n; i++) {
    if (outDated.count(i)) {
      continue;
    } else {
      if (minCost > specs[i][3]) {
        minCost = min(minCost, specs[i][3]);
        bestLaptop = i;
      }
    }
  }
  cout << bestLaptop + 1 << endl;
}
int32_t main() {
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
