#include <bits/stdc++.h>
int main() {
  int n, a[102], b[102], c[102], cost[102], rank[102], t, i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d %d %d %d", &a[i], &b[i], &c[i], &cost[i]);
    rank[i] = i;
  }
  for (i = 1; i < n; i++) {
    for (j = i + 1; j <= n; j++) {
      if (cost[i] > cost[j]) {
        t = a[i];
        a[i] = a[j];
        a[j] = t;
        t = b[i];
        b[i] = b[j];
        b[j] = t;
        t = c[i];
        c[i] = c[j];
        c[j] = t;
        t = cost[i];
        cost[i] = cost[j];
        cost[j] = t;
        t = rank[i];
        rank[i] = rank[j];
        rank[j] = t;
      }
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (a[i] < a[j] && b[i] < b[j] && c[i] < c[j]) {
        goto proceed;
      }
    }
    break;
  proceed:
    rank[0]++;
  }
  printf("%d", rank[i]);
  return (0);
}
