#include <bits/stdc++.h>
using namespace std;
long long n, k, m, i, j, a[1100], speed[1001], ram[1001], hdd[1001], cost[1001];
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) cin >> speed[i] >> ram[i] >> hdd[i] >> cost[i];
  for (i = 1; i <= n; i++)
    if (a[i] == 0)
      for (j = 1; j <= n; j++)
        if (i != j && a[j] == 0) {
          if (speed[i] > speed[j] && ram[i] > ram[j] && hdd[i] > hdd[j])
            a[j] = 1;
          if (speed[i] < speed[j] && ram[i] < ram[j] && hdd[i] < hdd[j]) {
            a[i] = 1;
            break;
          }
        }
  k = 10000;
  m = 1;
  for (i = 1; i <= n; i++)
    if (a[i] == 0 && k > cost[i]) {
      k = cost[i];
      m = i;
    }
  cout << endl << m;
  return 0;
}
