#include<bits/stdc++.h>
using namespace std ;
#define pnt 131072

int N , R , L ;
int d , t , x ;
int mt = 0 ;
int num[100010] = {} ;
int tree[262144][2] = {} ;

void f( int p ){
	if( p==0 ) return ;
	
	if( tree[p*2][0] >= tree[p*2+1][0] ){
		tree[p][0] = tree[p*2][0] ;
		tree[p][1] = tree[p*2][1] ;
	}
	else {
		tree[p][0] = tree[p*2+1][0] ;
		tree[p][1] = tree[p*2+1][1] ;
	}
	
	f( p/2 ) ;
}

int main(){
	cin >> N >> R >> L ;
	for( int i=1 ; i<=N ; i++ ) tree[pnt+i-1][1] = i ;
	f( pnt/2 ) ;
	for( int i=0 ; i<=R ; i++ ){
		if( i==R ) num[ tree[1][1] ] += L - mt ;
		else {
			cin >> d >> t >> x ;
			num[ tree[1][1] ] += t - mt ;
			mt = t ;
			tree[pnt+d-1][0] += x ;
			f( (pnt+d-1)/2 ) ;
		}
	}
	int mx = 0 , mxd = 0 ;
	for( int i=1 ; i<=N ; i++ ){
		if( mx < num[i] ){
			mx = num[i] ;
			mxd = i ;
		}
	}
	cout << mxd << endl ;
}