#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T> inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

using T = pair<ll, int>;
bool comp(T a, T b) {
    if (a.first == b.first)return a.second > b.second;
    return a.first < b.first;
}

class segtree {
    int n = 1; vector<pair<ll,int>> dat;
#define def {-LLINF/2,INF}
    T fun(T x, T y) { return max(x, y, comp); }
public:
    segtree(int _n) {
        while (n < _n)n *= 2;
        dat.resize(2 * n - 1, def);
        FOR(i, 0, _n)dat[i + n - 1] = { 0,i };
        rFOR(i, 0, n - 1)dat[i] = fun(dat[2 * i + 1], dat[2 * i + 2]);
    }
    segtree(VL a) {
        int _n = a.size();
        while (n < _n)n *= 2;
        dat.resize(2 * n - 1, def);
        FOR(i, 0, _n)dat[i + n - 1] = { a[i],i };
        rFOR(i, 0, n - 1)dat[i] = fun(dat[2 * i + 1], dat[2 * i + 2]);
    }
    void show() {
        FOR(i, 0, 2*n-1) {
            cout << dat[i].first << " " << dat[i].second << "\n";
        }
    }
    void add(int i, ll a) {
        i += n - 1;
        dat[i].first += a;
        while (i > 0) {
            --i /= 2;
            dat[i] = fun(dat[2 * i + 1], dat[2 * i + 2]);
        }
    }
    T get(int a, int b, int k, int l, int r) {
        if (b <= l || r <= a)return def;
        if (a <= l && r <= b)return dat[k];
        else {
            T s = get(a, b, 2 * k + 1, l, (l + r) / 2);
            T t = get(a, b, 2 * k + 2, (l + r) / 2, r);
            return fun(s, t);
        }
    }
    T get(int a, int b) { return get(a, b, 0, 0, n); }
};

struct Log {
    int id, time;
    ll point;

    bool operator<(const Log& a) {
        return time < a.time;
    }
};

int main() {
    init();

    int n, r, l;
    cin >> n >> r >> l;

    vector<Log> logs(r);
    FOR(i, 0, r) {
        int d, t; ll x;
        cin >> d >> t >> x;
        logs[i] = { --d,t,x };
    }
    logs.push_back({ 0,0,0LL });
    logs.push_back({ 0,l,0LL });
    SORT(logs);

    segtree seg(n);
    VI ans(n, 0);
    int next_time = 0;
    eFOR(i, 1, r) {
        seg.add(logs[i].id, logs[i].point);
        if (logs[i].time < logs[i + 1].time) {
            next_time = logs[i + 1].time;
            ans[seg.get(0, n).second] += next_time - logs[i].time;
            //cout << seg.get(0, n).second << "\n";
        }
    }
    //seg.show();

    int id = 1, time = 0;
    FOR(i, 0, n) {
        //cout << ans[i] << "\n";
        if (chmax(time, ans[i]))id = i + 1;
    }
    cout << id << "\n";
}


Measured memory_bytes: 23164