#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fr first
#define sc second
typedef pair<int,int> pii;
typedef vector<int> vi;
const int INF = (1<<25);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){
  priority_queue<pii >q;
  int N,R,L,S[1000001],T[1000001],d,t,x;

  cin>> N>> R>> L;
  q.push(pii(0,-1));

  for(int i=0;i<=N;i++) S[i]=T[i]=0;
  int pret=0,pred=1;

  for(int i=0;i<R;i++){
    cin>> d>> t>> x;
    S[d]+=x;
    q.push(pii(S[d],-d));
    while(1){
      pii p=q.top();
      if(p.fr==S[-p.sc]){
	T[pred]+=t-pret;
	pred=-p.sc;
	pret=t;
	break;
      }
      q.pop();
    }
  }
  T[pred]+=L-pret;
  int max=-INF;
  int ans=0;
  for(int i=1;i<=N;i++){
    if(max<T[i]){
      max=T[i]; ans=i;
    }
  }
  cout<< ans<< endl;
}