#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define all(a) a.begin(),a.end()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)

typedef pair<int, int> pii;
typedef vector<pii> vpii;

const int inf = 1e9;

struct Segtree {
	int n;
	vpii dat;

	void init(int n_) {
		n = 1;

		while (n < n_) n *= 2;

		dat.resize(2 * n);

		for (int i = 0; i < 2 * n - 1; ++i) dat[i] = pii(0, -inf);
	}

	void update(int a, int x) {
		int idx = a;
		a += n - 1;

		dat[a].fst += x;
		dat[a].scd = -idx;

		while (a > 0) {
			a = (a - 1) / 2;
			dat[a] = max(dat[a * 2 + 1], dat[a * 2 + 2]);
		}
	}

	pii get_max() {
		return dat[0];
	}
};

typedef pair<int, pair<int, int> > Query;

int res[100010];

signed main()
{
	int N, R, L; scanf("%d%d%d", &N, &R, &L);

	Segtree seg;
	seg.init(N);

	vector<Query> queries(R);

	rep(i, R) {
		int d, t, x;
		scanf("%d%d%d", &d, &t, &x);

		-- d;

		queries[i] = Query(t, pii(d, x));
	}

	queries.PB(Query(L, pii(0, 0)));
	
	sort(all(queries));

	rep(i, R) {
		Query query = queries[i];
		Query next_query = queries[i + 1];

		seg.update(query.scd.fst, query.scd.scd);

		if (query.fst != next_query.fst) {
			res[-seg.get_max().scd] += next_query.fst - query.fst;
		}
	}

	int ma = -1;
	int ans = -1;

	rep(i, N) {
		if (ma < res[i]) {
			ma = res[i];
			ans = i;
		}
	}

	printf("%d\n", ans + 1);
}