// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

#include<map>

using namespace std;

typedef pair<int,int> P;

#define fr first

#define sc second

P seg[1<<18];

int n;

void update(int id,int pt){

  int k = id + n - 1;

  seg[k].fr += pt;

  seg[k].sc = -id;

  while(k != 0){

    k = ( k - 1 ) / 2;

    seg[k] = max(seg[2*k+1],seg[2*k+2]);

  }

}

void init(int size) {

  n = 1;

  while(n < size) n *= 2;

}

int main(){

  int N,R,L;

  cin >> N >> R >> L;

  init(N);

  for(int i = 0 ; i < N ; i++ ) update(i,0);

  int mostid = 0 , now = 0 , sum[100000] = {};

  for(int i = 0 ; i < R ; i++ ){

    int d,t,x;

    cin >> d >> t >> x;

    update(d-1,x);

    sum[mostid] += t - now;

    now = t;

    mostid = -seg[0].sc;

  }

  sum[mostid] += L - now;

  int rec = 0;

  for(int i = 0 ; i < N ; i++) if( sum[rec] < sum[i] ) rec = i;

  cout << rec + 1 << endl;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

#include<map>

using namespace std;

typedef pair<int,int> P;

#define fr first

#define sc second

P seg[1<<18];

int n;

void update(int id,int pt){

  int k = id + n - 1;

  seg[k].fr += pt;

  seg[k].sc = -id;

  while(k != 0){

    k = ( k - 1 ) / 2;

    seg[k] = max(seg[2*k+1],seg[2*k+2]);

  }

}

void init(int size) {

  n = 1;

  while(n < size) n *= 2;

  for(int i = 0 ; i < size ; i++ ) update(i,0);

}

int main(){

  int N,R,L;

  scanf("%d %d %d",&N,&R,&L);

  init(N);

  int mostid = 0 , now = 0 , sum[100000] = {};

  for(int i = 0 ; i < R ; i++ ){

    int d,t,x;

    scanf("%d %d %d",&d,&t,&x);

    update(d-1,x);

    sum[mostid] += t - now;

    now = t;

    mostid = -seg[0].sc;

  }

  sum[mostid] += L - now;

  int rec = 0;

  for(int i = 0 ; i < N ; i++) if( sum[rec] < sum[i] ) rec = i;

  printf("%d\n",rec+1);

}

// Fastest known solution for this problem:
#include <iostream>

#include<algorithm>

#include<cassert>

using namespace std;



int main(){



 int N,R,L;

 int INF = 1e9;



 cin >> N >> R >> L;





 pair <int,int>  score[200005];

 int time[100005];

 for(int i=1;i<200005;i++)score[i]=make_pair(INF,-1);

 int id[200005] = {};

 for(int i=1;i<=N;i++) {

   score[i]=make_pair(0,i);

   id[i] = i;

   time[i] = 0;

 }

 

 int  mae = 0;

 

 int d,t,x;

 for(int i=0;i<R;i++) {

   cin >> d >> t >> x;



 int site1 = id[d];

   assert(site1>=1);

   

   time[score[1].second] += t - mae;

   score[site1].first -= x;

   mae = t;



   if(x>0){ 

     while(site1>1) {

       if(score[site1] < score[site1/2] ) {

	 swap(score[site1], score[site1/2]);

	 id[score[site1].second]= site1;

	 id[score[site1/2].second] = site1/2;

       site1 = site1/2;

     } else break;

     }

   }

   else {

     while(1) {

       if( score[2*site1] < score[site1] || score[2*site1+1] < score[site1]) {

	 int flg = 0;

	 if(score[2*site1] > score[2*site1+1]) flg = 1;

	 swap(score[site1],score[2*site1+flg]);

	 id[score[site1].second] = site1;

	 id[score[2*site1+flg].second] = 2*site1+flg;

	 site1 = 2*site1+flg;

       }else break;

     }

   }

   /*    for(int j=1;j<=N;j++) cout<<score[j].second;

	 cout << endl;

	 for(int j=1;j<=N;j++) cout <<score[j].first <<" ";

	 cout << endl;

	 for(int j=1;j<=N;j++) cout <<time[j] << " ";

	 cout << endl;

   */

 }

 



 time[score[1].second] += L-mae;

 

 int maxtime = -1;

 int ans;

 for(int i=1;i<=N;i++) 

   if(maxtime < time[i]) maxtime = time[i] ,ans = i;



 // for(int i=1;i<=N;i++) cout << time[i] <<" ";

 //cout << endl;

 

 cout << ans << endl;



 return 0;

 

 

}