import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;

void main(){

    int[] s = readln().split().to!(int[]);
    int n,r,l;
    n = s[0];
    r = s[1];
    l = s[2];
    int[] d,t,x;
    int[] p,pt;
    int maxp,maxt,now;
    for(int i=0;i<n;i++) {
	p ~= 0;
	pt ~= 0;
    }
    for(int i=0;i<r;i++){
	s = readln().split().to!(int[]);
	d ~= s[0]-1;
	t ~= s[1];
	x ~= s[2];
    }
    d ~= 0;
    t ~= l;
    x ~= 0;
    int pre = 0;
    for(int i=0;i<=r;i++){
	pt[now] += t[i]-pre;
	maxt = max(maxt,pt[now]);
	pre = t[i];
	p[d[i]] += x[i];
	if(x[i] > 0){
	    if(p[d[i]] == maxp && d[i] < now){
		now = d[i];
	    }else if(p[d[i]] > maxp){
		now = d[i];
		maxp = p[d[i]];
	    }
	}else if(now == d[i]){
	    now = 0;
	    int temp = maxp;
	    int tempnow = now;
	    maxp = -10000000;
	    for(int j=0;j<n;j++){
		if(maxp < p[j]){
		    maxp = p[j];
		    if(maxp == temp) break;
		    now = j;
		}
	    }
	}
    }
    for(int i=0;i<n;i++){
	if(pt[i] == maxt){
	    writeln(i+1);
	    break;
	}
    }
}