import std.stdio;
import std.algorithm;
import std.string;
import std.conv;
import std.array;
import std.typecons;
import std.container;

void main() {
	auto inp = readln.split.map!(to!int);
	int N = inp[0], R = inp[1], L = inp[2];
	alias Tuple!(int, "point", int, "time") Team;
	Team[] datas = new Team[N];
	foreach (i; 0..N) datas[i] = tuple(0, 0);
	int t = 0;
	alias Tuple!(int, "id", int, "point") MaxInfo;
	MaxInfo maxInfo = tuple(0,0);
	foreach (i; 0..R) {
		auto input = readln.split.map!(to!int).array;
		input[0]--;
		datas[input[0]].point += input[2];
		auto t2 = input[1];
		datas[maxInfo.id].time += t2 - t;
		if (datas[input[0]].point > maxInfo.point || (datas[input[0]].point == maxInfo.point && input[0] < maxInfo.id)) {
			maxInfo = tuple(input[0], datas[input[0]].point);
		} else if (maxInfo.id == input[0]) {
			int max = 0, id = 0;
			foreach (j; 0..N) {
				if (datas[j].point > max) {
					max = datas[j].point;
					id = j;
				}
			}
			maxInfo = tuple(id, max);
		}
		t = t2;
	}
	datas[maxInfo.id].time += L - t;
	int max = 0;
	int maxId = 0;
	foreach(i; 0..N) {
		if (datas[i].time > max) {
			max = datas[i].time;
			maxId = i;
		}
	}
	writeln(maxId+1);
}