// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.6016265990177077x):
#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;

}