#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
struct param {
  int speed, ram, hdd, cost;
};
vector<param> note;
vector<bool> used;
int n;
bool check(int x) {
  for (int i = 1; i <= n; i++)
    if (i != x && (note[x].speed < note[i].speed && note[x].ram < note[i].ram &&
                   note[x].hdd < note[i].hdd))
      return true;
  return false;
}
int main() {
  scanf("%d", &n);
  note.resize(n + 1);
  used.resize(n + 1);
  for (int i = 1; i <= n; i++)
    scanf("%d%d%d%d", &note[i].speed, &note[i].ram, &note[i].hdd,
          &note[i].cost);
  for (int i = 1; i <= n; i++)
    if (check(i)) used[i] = true;
  int numb = 0, best = inf;
  for (int i = 1; i <= n; i++)
    if (!used[i] && note[i].cost < best) {
      numb = i;
      best = note[i].cost;
    }
  printf("%d\n", numb);
  return 0;
}
