#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<set>
#include<list>
#include<map>

using namespace std;


/*
//1
int main(){
	for(int i=0; i<7;i++){
		int a, b;
		cin >> a >> b;
		cout << a- b << endl;

	}

	return 0;
}
*/

/*
//2
int main(){
	int t[4] = {6000, 4000, 3000, 2000};
	for(int i=0; i<4; i++){
		int T,n;
		cin >> T >> n;
		T--;
		cout << t[T]*n << endl;
	}

	return 0;
}
*/

/*
//3
int main(){
	int N;
	cin >> N;
	for(int i=0; i<N; i++){
		int x, y, b, p;
		cin >> x >> y >> b >> p;
		
		if(b >= 5 && p >= 2){
			int ans = (b*x + p*y)*0.8;
			cout << ans << endl;
		}
		else if(b >= 5 && p < 2){
			int ans = (b*x + 2*y)*0.8;
			ans = min( b*x + p*y, ans );
			cout << ans << endl;
		}
		else if(b < 5 && p >= 2){
			int ans = (5*x + p*y)*0.8;
			ans = min( b*x + p*y, ans );
			cout << ans << endl;
		}
		else{
			int ans = (5*x + 2*y)*0.8;
			ans = min( b*x + p*y, ans );
			cout << ans << endl;
		}
	}

	return 0;
}
*/

/*
//4
int main(){
	while(true){
		int N;
		cin >> N;
		if(N == 0) break;
		int ans = 2;
		int num = N;
		bool b = false;
		for(int i=0; i<N; i++){
			int k;
			cin >> k;
			if(k == 0) num--;
			if(k >= 2) b = true;
		}
		if(b){
			cout << ans + num - 1 << endl;
		}
		else{
			cout << "NA" << endl;
		}
	}



	return 0;
}
*/

/*
//5
int main(){
	while(true){
		int N;
		cin >> N;
		if(N == 0) break;
		string C;
		cin >> C;

		int card[100];
		for(int i=0; i<N; i++){
			card[i] = 0;
		}

		int now = 0;
		int ba = 0;
		for(int i=0; i<C.size(); i++){
			if(C[i] == 'M'){
				card[now]++;
			}
			if(C[i] == 'L'){
				card[now]++;
				card[now] += ba;
				ba = 0;
			}
			if(C[i] == 'S'){
				card[now]++;
				ba += card[now];
				card[now] = 0;
			}

			now++;
			if(now == N) now = 0;
		}
		sort(card, card+N);

		for(int i= 0; i<N; i++){
			cout << card[i] << " ";
		}

		cout << ba << endl;
	}


	return 0;
}
*/

/*
//6
int main(){
	int Q;
	cin >> Q;
	for(int i=0; i<Q; i++){
		int c,a,n;
		cin >> c >> a >> n;
		int ans = 0;
		while(c != 0 && a != 0 && n != 0){
			c--;
			a--;
			n--;
			ans++;
		}
		while(c >= 2 && a >= 1){
			c -= 2;
			a--;
			ans++;
		}
		while(c >= 3){
			c -= 3;
			ans++;
		}
		cout << ans << endl;
	}

	return 0;
}
*/


//7
int main(){
	int N,R,L;
	cin >> N >> R >> L;
	int s[100001];
	int ans[100001];
	set<pair<int,int> > lank;
	for(int i=1; i<=N; i++){
		s[i] = 0;
		ans[i] = 0;
		lank.insert(make_pair(0,i));
	}
	
	int last_top = N;
	int last_time = 0;
	for(int i=0; i<R; i++){
		int d,t,x;
		cin >> d >> t >> x;
		d = N-d+1;
		ans[last_top] += t - last_time;
		lank.erase(lank.find(make_pair(s[d],d))); //O(N)
		s[d] += x;

		auto itr = lank.lower_bound(make_pair(s[d],d)); //O(N)
		lank.insert(itr, make_pair(s[d],d));
		
		auto it = lank.end();
		it--;
		last_top = (*it).second;
		last_time = t;
	}
	ans[last_top] += L - last_time;

	int answer = -1;
	int tmp = -1;
	for(int i=N; i>=1; i--){
		if(ans[i] > tmp){
			answer = i;
			tmp = ans[i];
		}
	}

	cout << N-answer+1 << endl;

	return 0;
}


/*
//8
int N,Q;
int s[1000001];

int main(){
	cin >> N >> Q;
	for(int i=1; i<=N; i++){
		cin >> s[i];
	}
	
	multiset<int> leader;
	for(int i=0; i<Q; i++){
		string type;
		cin >> type;
		if(type == "ADD"){
			int a;
			cin >> a;
			leader.insert(s[a]);
		}
		if(type == "REMOVE"){
			int a;
			cin >> a;
			leader.erase(leader.find(s[a]));
		}
		if(type == "CHECK"){
			int x;
			cin >> x;
			if(leader.size() == 0){
				if(x >= N){
					cout << 0 << endl;
					continue;
				}
				else{
					cout << "NA" << endl;
					continue;
				}
			}

			int huka = 0;
			map<int,int> R; //score,人数
			for(int i=1; i<=N; i++){
				auto itr = leader.lower_bound(s[i]);
				if(itr == leader.end()){
					huka++;
					continue;
				}
				int tmp = *itr - s[i];
				R[tmp]++;
			}
			if(huka > x){
				cout << "NA" << endl;
				continue;
			}
			int sum = 0;
			for(auto itr=R.begin(); itr!=R.end(); itr++){
				sum += itr->second;
				if(N-sum <= x){
					cout << itr->first << endl;
					break;
				}
			}
		}
	}

	return 0;
}
*/

/*
//9
int main(){


	return 0;
}
*/

/*
//10
int main(){


	return 0;
}
*/




Measured memory_bytes: 8588