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

#include<utility>

#include<climits>



typedef std::pair<int, int> P;



const int MAX_N = 1 << 17;



int n;

// fst: -得点, snd: チームの番号

P dat[MAX_N * 2 - 1];



int cnt[MAX_N];



void init( int n_ )

{

	n = 1;

	while( n < n_ )

		n *= 2;



	for( int i = 0; i != n * 2 - 1; ++i )

		dat[i] = std::make_pair( INT_MAX, INT_MAX );



	return;

}



void update( int k, P x )

{

	k += n - 1;

	dat[k] = x;

	while( k > 0 )

	{

		k = (k - 1) / 2;

		dat[k] = std::min( dat[k*2+1], dat[k*2+2] );

	}



	return;

}



// [a,b)

P query( int a, int b, int k, int l, int r )

{

	if( a >= r || b <= l )

		return std::make_pair( INT_MAX, INT_MAX );

	

	if( a <= l && r <= b )

		return dat[k];

	else

	{

		P vl = query( a, b, k * 2 + 1, l, (l + r) / 2 );

		P vr = query( a, b, k * 2 + 2, (l + r) / 2, r );

		

		return std::min( vl, vr );

	}

}



int main()

{

	int N, R, L;

	std::cin >> N >> R >> L;



	init( N );

	for( int i = 0; i != N; ++i )

		update( i, std::make_pair( 0, i ) );



	int prevT = 0;

	for( int i = 0; i != R; ++i )

	{

		int d, t, x;

		std::cin >> d >> t >> x;



		--d;



		if( t != prevT )

		{

			P p = query( 0, N, 0, 0, n );

			cnt[p.second] += t - prevT;

		}



		P p = query( d, d + 1, 0, 0, n );

		update( d, std::make_pair( p.first - x, p.second ) );



		prevT = t;

	}



	if( prevT != L )

	{

		P p = query( 0, N, 0, 0, n );

		cnt[p.second] += L - prevT;

	}



	int t = -1, id;

	for( int i = 0; i != N; ++i )

	{

		if( t < cnt[i] )

		{

			t = cnt[i];

			id = i + 1;

		}

	}

	

	std::cout << id << std::endl;



	return 0;

}

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

#include<algorithm>

#include<utility>

#define rep(i,a) for( int i = 0; i != (a); ++i )



typedef std::pair<int, int> P;



const int MAX_N = 1 << 17, INF = 1 << 30;



int sz;

P dat[2*MAX_N-1];



void init( int n )

{

	sz = 1;

	while( sz < n )

		sz <<= 1;



	rep( i, 2*sz-1 )

		dat[i] = P( INF, INF );



	return;

}



void update( int k, P p )

{

	k += sz-1;

	dat[k] = p;



	while( k > 0 )

	{

		k = (k-1)>>1;

		dat[k] = std::min( dat[2*k+1], dat[2*k+2] );

	}



	return;

}



P query( int a, int b, int k, int l, int r )

{

	if( b <= l || r <= a )

		return P( INF, INF );



	if( a <= l && r <= b )

		return dat[k];

	else

		return std::min( query( a, b, 2*k+1, l, (l+r)>>1 ), query( a, b, 2*k+2, (l+r)>>1, r ) );

}



int N, R, L;

int cnt[MAX_N];



int main()

{

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



	init( N );

	rep( i, N )

		update( i, P( 0, i ) );

	

	int prvT = 0;

	rep( i, R )

	{

		int d, t, x;

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



		if( prvT != t )

			cnt[query( 0, N, 0, 0, sz ).second] += t - prvT;



		--d;

		P p = query( d, d+1, 0, 0, sz );

		update( d, P( p.first - x, p.second ) );

		prvT = t;

	}



	if( L != prvT )	

		cnt[query( 0, N, 0, 0, sz ).second] += L - prvT;

	

	printf( "%d\n", std::max_element( cnt, cnt+N )-cnt+1 );



	return 0;

}

// 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;

 

 

}