#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[1000], b[1000], c[1000], d[1000];
bool bo[1000];
int main() {
  int i, j, k, ans = 0;
  cin >> n;
  k = 0;
  int ma = 999999999;
  for (i = 1; i <= n; i++) {
    bo[i] = true;
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    for (j = 1; j < i; j++) {
      if (a[i] < a[j] && b[i] < b[j] && c[i] < c[j]) bo[i] = false;
      if (a[i] > a[j] && b[i] > b[j] && c[i] > c[j]) bo[j] = false;
    }
  }
  for (i = 1; i <= n; i++)
    if (bo[i]) {
      if (ma > d[i]) {
        ans = i;
        ma = d[i];
      }
    }
  cout << ans << endl;
  return 0;
}
