#include <iostream>
const int SIZE = 1 << 17;
const int INF = 1 << 30;
using namespace std;
int segment[2 * SIZE];
int point[SIZE + 1];
int now, times[SIZE];
int viewTime;
int value(int ID){
	return point[ID];
}
void compare(int n){
	int acces;
	if (value(segment[n * 2 + 1]) >= value(segment[n * 2 + 2]))
		acces = segment[n * 2 + 1];
	else
		acces = segment[n * 2 + 2];
	segment[n] = acces;
	if (n != 0)
		compare((n - 1) / 2);

}
void add(int n, int x){
	int acces = SIZE - 2 + n;
	point[n] += x;
	compare((acces - 1) / 2);
}
int main() {
	int N, R, L, d, t, x,last=0;
	cin >> N >> R >> L;
	for (int i = 1; i <= N; i++){
		segment[SIZE + i - 2] = i;
		add(i, 0);
	}
	for (int i = 0; i<=R; i++){
		if (i!=R)
		cin >> d >> t >> x;
		else{
			d = 1;
			t = L;
			x = 0;
		}
		if (t != last)
			times[segment[0]] += t - last;
		last = t;
		add(d, x);
	}
	int maxim =1;
	for (int i = 1; i <= N; i++){
		if (times[maxim]<times[i])
			maxim = i;
	}
	cout << maxim << endl;
	// your code goes here
	cin >> x;
	return 0;
}