#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long mxn = 1e5 + 7;
const long long inf = 1e18;
inline void normal(long long &a) {
  a %= mod;
  (a < 0) && (a += mod);
}
inline long long modMul(long long a, long long b) {
  a %= mod, b %= mod;
  normal(a), normal(b);
  return (a * b) % mod;
}
inline long long modAdd(long long a, long long b) {
  a %= mod, b %= mod;
  normal(a), normal(b);
  return (a + b) % mod;
}
inline long long modSub(long long a, long long b) {
  a %= mod, b %= mod;
  normal(a), normal(b);
  a -= b;
  normal(a);
  return a;
}
inline long long modPow(long long b, long long p) {
  long long r = 1;
  while (p) {
    if (p & 1) r = modMul(r, b);
    b = modMul(b, b);
    p >>= 1;
  }
  return r;
}
inline long long modInverse(long long a) { return modPow(a, mod - 2); }
inline long long modDiv(long long a, long long b) {
  return modMul(a, modInverse(b));
}
struct str {
  long long a, b, c, d, inx;
};
bool cmp(str s1, str s2) {
  if (s1.d != s2.d) {
    return s1.d < s2.d;
  }
}
int main() {
  long long i, j, k, a, b, c, d, n, m, t, u, v, w, x, y, z;
  cin >> n;
  str s[n];
  for (i = 0; i < n; i++) {
    cin >> a >> b >> c >> d;
    s[i].a = a;
    s[i].b = b;
    s[i].c = c;
    s[i].d = d;
    s[i].inx = i + 1;
  }
  long long cost = inf, ans = 0;
  sort(s, s + n, cmp);
  for (i = 0; i < n; i++) {
    a = s[i].a;
    b = s[i].b;
    c = s[i].c;
    bool ok = true;
    for (j = 0; j < n; j++) {
      x = s[j].a;
      y = s[j].b;
      z = s[j].c;
      if (i != j) {
        if (a < x and b < y and c < z) {
          ok = false;
          break;
        }
      }
    }
    if (ok) {
      long long cur = s[i].d;
      if (cur < cost) {
        ans = s[i].inx;
        break;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
