#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  vector<int> speed;
  vector<int> ram;
  vector<int> hdd;
  vector<int> cost;
  int arr[t];
  for (int i = 0; i < t; i++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    speed.push_back(a);
    ram.push_back(b);
    hdd.push_back(c);
    cost.push_back(d);
    arr[i] = d;
  }
  int ct = 0;
here:
  for (int i = 0; i < speed.size(); i++) {
    for (int j = 0; j < speed.size(); j++) {
      if (speed[i] < speed[j] && ram[i] < ram[j] && hdd[i] < hdd[j]) {
        arr[i + ct] = 0;
        speed.erase(speed.begin() + i);
        ram.erase(ram.begin() + i);
        hdd.erase(hdd.begin() + i);
        cost.erase(cost.begin() + i);
        ct++;
        goto here;
      }
    }
    if (i == speed.size() - 1) break;
  }
  int min = 1000, index;
  if (t == 1) {
    cout << 1;
  } else {
    for (int i = 0; i < t; i++) {
      if (arr[i] != 0 && arr[i] < min) {
        min = arr[i];
        index = i + 1;
      }
    }
    cout << index;
  }
  return 0;
}
