#include <bits/stdc++.h>
using namespace std;
template <typename T>
void printvec(vector<T> a) {
  for (long long i = 0; i < a.size(); i++) cout << a[i] << " ";
  cout << endl;
}
bool myfun(vector<int> a, vector<int> b) { return a[3] < b[3]; }
int main() {
  int n;
  cin >> n;
  vector<vector<int> > laps;
  while (n--) {
    int speed, ram, hdd, cost;
    cin >> speed >> ram >> hdd >> cost;
    vector<int> temp;
    temp.push_back(speed);
    temp.push_back(ram);
    temp.push_back(hdd);
    temp.push_back(cost);
    laps.push_back(temp);
  }
  vector<vector<int> > checkLaps;
  for (int i = 0; i < laps.size(); i++) {
    bool outdated = false;
    int speed = laps[i][0];
    int ram = laps[i][1];
    int hdd = laps[i][2];
    int cost = laps[i][3];
    for (int j = 0; j < laps.size(); j++) {
      if (speed < laps[j][0] && ram < laps[j][1] && hdd < laps[j][2]) {
        outdated = true;
        break;
      }
    }
    if (!outdated) {
      vector<int> good = laps[i];
      good.push_back(i);
      checkLaps.push_back(good);
    }
  }
  sort(checkLaps.begin(), checkLaps.end(), myfun);
  cout << checkLaps[0][4] + 1 << endl;
  return 0;
}
