#include <cstdio>
#include <queue>
#include <algorithm>
using namespace std;

int main(){
	int n, r, l, d, t, x, u = 0;
	scanf("%d%d%d", &n, &r, &l);
	int m = 1;
	while(m < n){
		m <<= 1;
	}
	vector<int> s(n), c(n), p(2 * m - 1, n - 1);
	for(int i = n - 1; i >= 0; --i){
		p[i + m - 1] = i;
	}
	for(int i = m - 2; i >= 0; --i){
		p[i] = p[i * 2 + 1];
	}
	for(int i = 0; i < r; ++i){
		scanf("%d%d%d", &d, &t, &x);
		c[p[0]] += t - u;
		u = t;
		s[d - 1] += x;
		d += m - 2;
		while(d > 0){
			d = (d - 1) >> 1;
			p[d] = p[2 * d + (s[p[2 * d + 1]] >= s[p[2 * d + 2]] ? 1 : 2)];
		}
	}
	c[p[0]] += l - u;

	int ans = max_element(c.begin(), c.end()) - c.begin() + 1;
	printf("%d\n", ans);
}