#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
const int inf = 1 << 27;
int main(void) {
  int n;
  vector<int> cost;
  map<int, pair<int, pair<int, int> > > m;
  cin >> n;
  for (int i = (0); i < (n); ++i) {
    int s, r, h, c;
    cin >> s >> r >> h >> c;
    pair<int, pair<int, int> > p;
    pair<int, int> pp;
    p.first = s;
    pp.first = r;
    pp.second = h;
    p.second = pp;
    m[c] = p;
    cost.push_back(c);
  }
  for (map<int, pair<int, pair<int, int> > >::iterator it = m.begin();
       it != m.end(); it++) {
    int s = it->second.first;
    int r = it->second.second.first;
    int h = it->second.second.second;
    int c = it->first;
    bool found = false;
    for (map<int, pair<int, pair<int, int> > >::iterator itt = it;
         itt != m.end(); itt++) {
      int ss = itt->second.first;
      int rr = itt->second.second.first;
      int hh = itt->second.second.second;
      if (s < ss && r < rr && h < hh) {
        found = true;
        break;
      }
    }
    if (!found) {
      for (int i = (0); i < ((int((cost).size()))); ++i) {
        if (cost[i] == c) {
          cout << (i + 1) << endl;
          break;
        }
      }
      break;
    }
  }
  return 0;
}
