#include<bits/stdc++.h>
using namespace std;

using i64 = long long int;

const i64 MAX_N = 1ll << 20;
const i64 INF = 1e12;

struct Node{
    i64 id, point;
    bool operator<(const Node &obj)const{
        if(point == obj.point)return id > obj.id;
        return point < obj.point;
    }
};

i64 n, times[MAX_N]={0};
Node dat[2*MAX_N-1];

void init(i64 n_){
    n = 1;
    while(n < n_)n *= 2;
    for(i64 i=0;i<2*n-1;i++)dat[i] = (Node){INF, -INF};
    for(i64 i=0;i<n_;++i)dat[i+n-1] = (Node){i, 0};
}

void update(i64 k, i64 a){
    k += n - 1;
    dat[k].point += a;
    while(k > 0){
        k = (k - 1) / 2;
        dat[k] = max(dat[k*2 + 1], dat[k*2 + 2]);
    }
}

Node query(i64 a, i64 b, i64 k, i64 l, i64 r){
    if(r <= a || b <= l)return (Node){INF, -INF};

    if(a <= l && r <= b)return dat[k];
    else{
        Node vl = query(a, b, k*2+1, l, (l+r)/2);
        Node vr = query(a, b, k*2+2, (l+r)/2, r);
        return max(vl, vr);
    }
}

int main(){
    i64 N, R, L;
    cin >> N >> R >> L;
    init(N);
    i64 team = 0, prev_time = 0;
    for(int i=0;i<R;++i){
        i64 d, t, x;
        cin >> d >> t >> x;
        times[team] += (t - prev_time);
        prev_time = t;
        update(d-1, x);
        Node top = query(0, N, 0, 0, N);
        team = top.id;
    }
    times[team] += (L - prev_time);

    i64 maxi = LLONG_MIN, max_team = 0;
    for(int i=0;i<N;++i){
        if(times[i] > maxi){
            maxi = times[i];
            max_team = i;
        }
    }

    cout << max_team + 1 << endl;

    return 0;
}

