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

struct T {
    int id, score;
    int opCmp(const ref T o) const {
        if (score == o.score) return o.id - id;
        else return score - o.score;
    }
}

class SegTree {
    int size;
    int size2;
    T[] v;
    this(int size) {
        this.size = size;
        size2 = 1;
        while (size2 < size) {
            size2 *= 2;
        }
        v = new T[size2 * 2 + 1];
        foreach (ref e; v) {
            e.id = int.max;
            e.score = 0;
        }
        foreach (int i; 0 .. size) {
            int j = i + size2;
            v[j].id = i;
        }
    }
    void add(int i, int x) {
        int j = i + size2;
        v[j].score += x;
        j /= 2;
        while (j >= 1) {
            v[j] = max(v[j * 2], v[j * 2 + 1]);
            j /= 2;
        }
    }
    T maxElement() {
        return v[1];
    }
}

void main() {
    int N, R, L; readf("%d %d %d\n", &N, &R, &L);
    SegTree segtree = new SegTree(N);
    int u = 0;
    int m = 0;
    int[] tot = new int[N];
    foreach (_; 0 .. R) {
        int d, t, x; readf("%d %d %d\n", &d, &t, &x);
        d--;
        tot[m] += t - u;
        segtree.add(d, x);
        m = segtree.maxElement.id;
        //writeln([t, m + 1]);
        u = t;
    }
    tot[m] += L - u;
    int ans = 1;
    int ansT = 0;
    foreach (int i, t; tot) {
        if (t > ansT) {
            ansT = t;
            ans = i + 1;
        }
    }
    ans.writeln;
}