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

#include <cstring>

#include <cstdlib>

#include <cmath>

#include <complex>

#include <string>

#include <sstream>

#include <algorithm>

#include <vector>

#include <queue>

#include <stack>

#include <functional>

#include <iostream>

#include <map>

#include <set>

using namespace std;

typedef pair<int,int> P;

typedef long long ll;

typedef vector<int> vi;

typedef vector<ll> vll;

#define pu push

#define pb push_back

#define mp make_pair

#define eps 1e-9

#define INF 2000000000

#define sz(x) ((int)(x).size())

#define fi first

#define sec second

#define SORT(x) sort((x).begin(),(x).end())

#define all(x) (x).begin(),(x).end()

#define EQ(a,b) (abs((a)-(b))<eps)

const int SIZE = 1<<17;

int N,R,L;

struct segtree

{

	P seg[SIZE*2];

	void init()

	{

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

		{

			seg[i+SIZE-1].fi=0;

			seg[i+SIZE-1].sec=-i;

		}

	}

	void build()

	{

		for(int i=SIZE-2;i>=0;i--)seg[i]=max(seg[i*2+1],seg[i*2+2]);

	}

	void update(int k,int x)

	{

		k+=SIZE-1;

		seg[k].fi+=x;

		while(k>0)

		{

			k=(k-1)/2;

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

		}

	}

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

	{

		if(r<=a||b<=l)return P(-INF,INF);

		else if(a<=l&&r<=b)return seg[k];

		else return max(query(a,b,k*2+1,l,(l+r)/2),query(a,b,k*2+2,(l+r)/2,r));

	}

	P query()

	{

		return query(0,N,0,0,SIZE);

	}

};

segtree seg;

void print(){cout << -((seg.query()).sec) << endl;}

int total[100100];

int d[1000100],t[1000100],x[1000100];

vector<int> vx;

int main()

{

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

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

	{

		scanf("%d %d %d",&d[i],&t[i],&x[i]);

		d[i]--;

	}

	t[R]=L;

	seg.init();

	seg.build();

	//print();

	total[-((seg.query()).sec)]+=t[0];

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

	{

		seg.update(d[i],x[i]);

		//print();

		total[-((seg.query()).sec)]+=t[i+1]-t[i];

	}

	int ansv=-1,ans;

	for(int i=0;i<N;i++)if(ansv<total[i])

	{

		ansv=total[i];

		ans=i;

	}

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

	return 0;

}

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

#include <algorithm>

using namespace std;

typedef pair<int,int> P;

#define INF 2000000000

#define fi first

#define sec second

const int SIZE = 1<<17;

int N,R,L;

struct segtree

{

	P seg[SIZE*2];

	void init()

	{

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

		{

			seg[i+SIZE-1].fi=0;

			seg[i+SIZE-1].sec=-i;

		}

	}

	void build()

	{

		for(int i=SIZE-2;i>=0;i--)seg[i]=max(seg[i*2+1],seg[i*2+2]);

	}

	void update(int k,int x)

	{

		k+=SIZE-1;

		seg[k].fi+=x;

		while(k>0)

		{

			k=(k-1)/2;

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

		}

	}

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

	{

		if(r<=a||b<=l)return P(-INF,INF);

		else if(a<=l&&r<=b)return seg[k];

		else return max(query(a,b,k*2+1,l,(l+r)/2),query(a,b,k*2+2,(l+r)/2,r));

	}

	P query()

	{

		return query(0,N,0,0,SIZE);

	}

};

segtree seg;

int total[100100];

int d[1000100],t[1000100],x[1000100];

int main()

{

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

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

	{

		scanf("%d %d %d",&d[i],&t[i],&x[i]);

		d[i]--;

	}

	t[R]=L;

	seg.init();

	seg.build();

	total[-((seg.query()).sec)]+=t[0];

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

	{

		seg.update(d[i],x[i]);

		total[-((seg.query()).sec)]+=t[i+1]-t[i];

	}

	int ansv=-1,ans;

	for(int i=0;i<N;i++)if(ansv<total[i])

	{

		ansv=total[i];

		ans=i;

	}

	printf("%d\n",ans+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;

 

 

}