#include <bits/stdc++.h>
using namespace std;
long long labs(long long a) { return a < 0 ? (-a) : a; }
long long max(long long a, long long b) { return a > b ? a : b; }
long long min(long long a, long long b) { return a < b ? a : b; }
template <typename T>
struct Point {
  T x, y;
  Point() {}
  Point(T xx, T yy) : x(xx), y(yy) {}
};
template <typename T>
bool operator<(const Point<T> &p1, const Point<T> &p2) {
  return p1.x < p2.x || p1.x == p2.x && p1.y < p2.y;
}
const int MAXM = 3;
struct Note {
  deque<int> v;
  int cost;
  Note() {
    v = deque<int>(MAXM);
    old = false;
  }
  void Cin() {
    for (int(i) = 0; (i) < (MAXM); (i)++) cin >> v[i];
    cin >> cost;
  }
  bool old;
};
bool operator<(const Note &n1, const Note &n2) {
  for (int(i) = 0; (i) < (MAXM); (i)++) {
    if (n1.v[i] >= n2.v[i]) return false;
  }
  return true;
}
vector<Note> v;
int main() {
  int n;
  cin >> n;
  v.resize(n);
  for (int(i) = 0; (i) < (n); (i)++) {
    v[i].Cin();
  }
  for (int(i) = 0; (i) < (n); (i)++) {
    for (int(j) = 0; (j) < (n); (j)++) {
      if (v[i] < v[j]) {
        v[i].old = true;
      }
    }
  }
  int bestcost = INT_MAX;
  int res = -1;
  for (int(i) = 0; (i) < (n); (i)++) {
    if (!v[i].old && v[i].cost < bestcost) {
      bestcost = v[i].cost;
      res = i + 1;
    }
  }
  cout << res << endl;
  return 0;
}
