#include <stdio.h>
#include <vector>
#include <algorithm>


using namespace std;

int* heap_index;

struct Info{
	Info(){
		id=0;
		score = 0;
		time_sum = 0;
	}
	Info(int arg_id,int arg_score){
		id = arg_id;
		score = arg_score;
		time_sum = 0;
	}
	int id,score,time_sum;
};

class InfoPQ{
public:
	InfoPQ(int arg_n){
		array = new Info[arg_n];
		n = 0;
	}

	void push(Info arg_info){
		array[n] = arg_info;
		int tmp = n;
		while(tmp != 0 && array[tmp].id < array[(tmp-1)/2].id){
			std::swap(array[tmp], array[(tmp-1)/2]);
			tmp = (tmp-1)/2;
		}
		n++;
	}

	void writeHeapIndex(){
		for(int i=0;i<n;i++){
			heap_index[array[i].id] = i;
		}
	}

	void addTime(int time){
		array[0].time_sum += time;
	}

	void printResult(){
		int max_time = -1000000000,max_id;

		for(int i = 0; i < n; i++){
			if(array[i].time_sum > max_time){
				max_time = array[i].time_sum;
				max_id = array[i].id;
			}else if(array[i].time_sum == max_time && array[i].id < max_id){
				max_id = array[i].id;
			}
		}
		printf("%d\n",max_id);
	}

	void update(int update_id,int div){

		array[heap_index[update_id]].score += div;
		int tmp = heap_index[update_id];

		if(div > 0){
			while(tmp != 0 && ((array[tmp].score > array[(tmp-1)/2].score) || (array[tmp].score ==array[(tmp-1)/2].score && array[tmp].id < array[(tmp-1)/2].id))){
				std::swap(heap_index[array[tmp].id],heap_index[array[(tmp-1)/2].id]);
				std::swap(array[tmp], array[(tmp-1)/2]);
				tmp = (tmp-1)/2;
			}
		}else{
			while(2*tmp+1 <= n-1){
				if(2*tmp+2 <= n-1){
					if(((array[2*tmp+2].score > array[tmp].score) || (array[2*tmp+2].score == array[tmp].score && array[2*tmp+2].id < array[tmp].id)) &&
							((array[2*tmp+2].score > array[2*tmp+1].score) || (array[2*tmp+2].score == array[2*tmp+1].score && array[2*tmp+2].id < array[2*tmp+1].id))){
						std::swap(heap_index[array[tmp].id],heap_index[array[2*tmp+2].id]);
						std::swap(array[2*tmp+2],array[tmp]);
						tmp = 2*tmp+2;
					}else if(((array[2*tmp+1].score > array[tmp].score) || (array[2*tmp+1].score == array[tmp].score && array[2*tmp+1].id < array[tmp].id)) &&
							((array[2*tmp+1].score > array[2*tmp+2].score) || (array[2*tmp+1].score == array[2*tmp+2].score && array[2*tmp+1].id < array[2*tmp+2].id))){
						std::swap(heap_index[array[tmp].id],heap_index[array[2*tmp+1].id]);
						std::swap(array[2*tmp+1],array[tmp]);
						tmp = 2*tmp+1;
					}else{
						break;
					}
				}else{	//?????????????????¨???????????´???
					if((array[2*tmp+1].score > array[tmp].score) || (array[2*tmp+1].score == array[tmp].score && array[2*tmp+1].id < array[tmp].id)){
						std::swap(heap_index[array[tmp].id],heap_index[array[2*tmp+1].id]);
						std::swap(array[tmp],array[2*tmp+1]);
						tmp = 2*tmp+1;
					}else{
						break;
					}
				}
			}
		}
	}

private:
	Info* array;
	int n;
};



int main(){
	int N,R,L,pre,team_id,time,add;

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

	InfoPQ Q(N);
	heap_index = new int[N+1];

	for(int i = 0; i < N; i++)Q.push(Info(i+1,0));

	Q.writeHeapIndex();

	pre = 0;
	for(int i = 0; i < R; i++){
		scanf("%d %d %d",&team_id,&time,&add);
		Q.addTime(time-pre);
		Q.update(team_id,add);
		pre = time;
	}
	Q.addTime(L-pre);

	Q.printResult();

    return 0;
}

Measured memory_bytes: 4256