#include <bits/stdc++.h>
using namespace std;
void swap(int* a, int* b) {
  int t = *a;
  *a = *b;
  *b = t;
}
int partition(int arr[], int arr2[], int arr3[], int arr4[], int arr5[],
              int low, int high) {
  int pivot = arr[high];
  int i = (low - 1);
  for (int j = low; j <= high - 1; j++) {
    if (arr[j] < pivot) {
      i++;
      swap(&arr[i], &arr[j]);
      swap(&arr2[i], &arr2[j]);
      swap(&arr3[i], &arr3[j]);
      swap(&arr4[i], &arr4[j]);
      swap(&arr5[i], &arr5[j]);
    }
  }
  swap(&arr[i + 1], &arr[high]);
  swap(&arr2[i + 1], &arr2[high]);
  swap(&arr3[i + 1], &arr3[high]);
  swap(&arr4[i + 1], &arr4[high]);
  swap(&arr5[i + 1], &arr5[high]);
  return (i + 1);
}
void quickSort(int arr[], int arr2[], int arr3[], int arr4[], int arr5[],
               int low, int high) {
  if (low < high) {
    int pi = partition(arr, arr2, arr3, arr4, arr5, low, high);
    quickSort(arr, arr2, arr3, arr4, arr5, low, pi - 1);
    quickSort(arr, arr2, arr3, arr4, arr5, pi + 1, high);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int a[n], b[n], c[n], cost[n], d[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i] >> c[i] >> cost[i];
    d[i] = i + 1;
  }
  quickSort(cost, a, b, c, d, 0, n - 1);
  int index = -1;
  bool found = true;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (a[i] < a[j] and b[i] < b[j] and c[i] < c[j]) {
        found = false;
        break;
      }
    }
    if (found) {
      index = d[i];
      break;
    }
    found = true;
  }
  cout << index << endl;
  return 0;
}
