#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
#include <map>
#include <climits>
#include <stack>
#include <string>
#include <random>
#include<set>
#include <iomanip>
#include <climits>
#include <memory>
struct Team {
	int id{ 0 }, score{ 0 };
	Team() {};
	Team(int i, int s) :id{ i }, score{ s }{};
};
template<typename T, typename Compare>
class Heap;
class HeapElementHolder {
	template<typename T, typename C>
	friend class Heap;
	std::shared_ptr<int> in_heap_position{nullptr};
	void invalidate() { in_heap_position = nullptr; }
	HeapElementHolder(std::shared_ptr<int> &ptr) :in_heap_position(ptr) {}
public:
	HeapElementHolder() {}
	HeapElementHolder(const HeapElementHolder &holder) :in_heap_position{ holder.in_heap_position } {};
	bool is_valid() const { return in_heap_position != nullptr; }
};

template<typename T, typename Compare = std::function<bool(const T &, const T &)>>
class Heap {
	std::vector<T> _elements;
	std::vector<HeapElementHolder> _holders;
	Compare _is_prior;
	void sanitize_up(const int position) {
		if (position != 0) {
			auto up_pos = (position - 1) >> 1;
			auto up = upper(up_pos, (up_pos << 1) + 1, (up_pos << 1) + 2);
			if (up == position) {
				swap(up_pos, position);
				sanitize_up(up_pos);
			}
		}
	}
	void sanitize_down(const int position) {
		auto d = down(position, (position << 1) + 1, (position << 1) + 2);
		if (d != position) {
			swap(d, position);
			sanitize_down(d);
		}
	}
	void swap(const int a, const int b) {
		*_holders[a].in_heap_position = b;
		*_holders[b].in_heap_position = a;
		auto element = _elements[a];
		_elements[a] = _elements[b];
		_elements[b] = element;
		auto holder = _holders[a];
		_holders[a] = _holders[b];
		_holders[b] = holder;
 	}
	int upper(const int up, const int left, const int right) {
		if (left < 0) return right;
		else if (up < 0) {
			if (_is_prior(_elements[left], _elements[right])) return left;
			else return right;
		}
		else {
			if (_is_prior(_elements[up], _elements[left]) && _is_prior(_elements[up], _elements[right])) return up;
			else if (_is_prior(_elements[left], _elements[up]) && _is_prior(_elements[left], _elements[right])) return left;
			else return right;
		}
	}
	int down(const int up, const int left , const int right) const {
		if (left >= _elements.size()) return up;
		else if (right >= _elements.size()) {
			if (_is_prior(_elements[up], _elements[left])) return up;
			else return left;
		}
		else {
			if (_is_prior(_elements[up], _elements[left]) && _is_prior(_elements[up], _elements[right])) return up;
			else if (_is_prior(_elements[left], _elements[up]) && _is_prior(_elements[left], _elements[right])) return left;
			else return right;
		}
	}
public:
	Heap(const Compare &comp) :_is_prior{ comp } {};
	HeapElementHolder add(T && element) {
		auto result = HeapElementHolder();
		result.in_heap_position = std::make_shared<int>(_elements.size());
 		_elements.push_back(std::move(element));
		_holders.push_back(result);
		sanitize_up(_elements.size() - 1);
		return result;
	}
	HeapElementHolder add(const T &element) {
		auto result = HeapElementHolder();
		result.in_heap_position = std::make_shared<int>(_elements.size());
		_elements.push_back(element);
		_holders.push_back(result);
		sanitize_up(_elements.size() - 1);
		return result;
	}
	void update(HeapElementHolder &holder, const T &value) {
		if (_is_prior(value, _elements[*holder.in_heap_position])) {
			_elements[*holder.in_heap_position] = value;
			sanitize_up(*holder.in_heap_position);
		}
		else {
			_elements[*holder.in_heap_position] = value;
			sanitize_down(*holder.in_heap_position);
		}
	}
	void pop() {
		swap(0, _elements.size() - 1);
		_elements.pop_back();
		_holders.pop_back();
		sanitize_down(0);
	}
	T top() const {
		return _elements.front();
	}
};

template<typename T, typename Compare = std::function<bool(const T &, const T &)>>
class PriorityArray {
	std::vector<HeapElementHolder> _holders;
	std::vector<T> _elements;
	Heap<T, Compare> heap;
public:
	PriorityArray(const int size, const T &default_value, const Compare &comp) :_holders(size), _elements(size, default_value), heap(comp) {
		for (auto i = 0; i < size; ++i) {
			_holders[i] = heap.add(_elements[i]);
		}
	}
	void push_back(const T &value) {
		_elements.push_back(value);
		_holders.push_back(heap.add(value));
	}
	size_t size() const {
		return _elements.size();
	}
	void update(const int index, const T& value) {
		_elements[index] = value;
		heap.update(_holders[index], value);
	}
	T at(const int index) {
		return _elements[index];
	}
	const T &at(const int index) const {
		return _elements[index];
	}
	T top() const { return heap.top(); }
};
int main() {
	int n, r, l; std::cin >> n >> r >> l;
	std::vector<int> sum_time(n, 0);
	auto compare = [](const Team &a, const Team &b) {return (a.score == b.score) ? a.id < b.id: a.score > b.score; };
	auto scores = PriorityArray<Team>(n, Team(), compare);
	auto prev_time = 0;
	for (auto i = 0; i < r; ++i) {
		int d, t, x; std::cin >> d >> t >> x;
		sum_time[scores.top().id] += t - prev_time;
		scores.update(d - 1, Team( d - 1, x + scores.at(d - 1).score ));
		prev_time = t;
	}
	sum_time[scores.top().id] += l - prev_time;
	auto max_team = 0;
	for (auto i = 0; i < sum_time.size(); ++i) {
		if (sum_time[max_team] < sum_time[i]) max_team = i;
	}
	std::cout << max_team + 1 << std::endl;
}


/*



*/



Measured memory_bytes: 11056