#include <bits/stdc++.h>
using namespace std;
int less_than(vector<int>& a, vector<int>& b) {
  for (int i = 0; i < 3; ++i)
    if (a[i] >= b[i]) return false;
  return true;
}
int main(int argc, char* argv[]) {
  int n;
  cin >> n;
  vector<vector<int> > v(n, vector<int>(5));
  for (int i = 0; i < n; ++i) {
    cin >> v[i][0] >> v[i][1] >> v[i][2] >> v[i][3];
    v[i][4] = i + 1;
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j)
      if (less_than(v[i], v[j])) {
        v[i][3] = 10000;
        break;
      }
  int lowest = 0;
  for (int i = 1; i < n; ++i)
    if (v[i][3] < v[lowest][3]) lowest = i;
  cout << v[lowest][4] << endl;
}
