#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<vector<int>, int>> v, ans;
  for (int i = 0; i < n; i++) {
    vector<int> temp(4);
    for (auto &it : temp) cin >> it;
    v.push_back({temp, i + 1});
  }
  for (int i = 0; i < n; i++) {
    int f = 1;
    for (int w = 0; w < n; w++) {
      int c = 0;
      for (int j = 0; j < 3; j++) {
        if (v[i].first[j] < v[w].first[j]) c++;
      }
      if (c == 3) {
        f = 0;
        break;
      }
    }
    if (f) ans.push_back(v[i]);
  }
  int mn = INT32_MAX, idx = -1;
  for (int i = 0; i < int(ans.size()); i++) {
    if (ans[i].first[3] < mn) {
      mn = ans[i].first[3];
      idx = ans[i].second;
    }
  }
  cout << idx << endl;
}
