#include <iostream>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#define REP(i,n) for(int i = 0; i < n; i++)
#define REP(j,n) for(int j = 0; j < n; j++)
using namespace std;
typedef pair<int, int> P;
int main() {
    int n,r,l;
    cin >> n;
    cin >> r;
    cin >> l;
    int list[n+1];
    int time[n+1];
    for(int i = 0; i < n+1; i++) {
        list[i] = 0;
        time[i] = 0;
    }
    int top = 0;
    int id  = 1;
    int nowtime = 0;
    int timemax = 0;
    int timemaxid = 0;
    for(int i = 0; i < r; i++) {
        int d,t,x;
        cin >> d;
        cin >> t;
        cin >> x;
        time[id] += t - nowtime;
        if(time[id] > timemax) {
            timemax = time[id];
            timemaxid = id;
        }
        nowtime = t;
        list[d] += x;
        if(id == d) {
            top += x;
        }
        if(x < 0 && d == id) {
            for(int j = 1; j < n+1; j++) {
                if(top < list[j] || (top == list[j] && j < id)) {
                    top = list[j];
                    id = j;
                }
            }
            
        }
        if(x > 0 && d != id) {
            if(top < list[d] || (top == list[d] && d < id)) {
                top = list[d];
                id = d;
            }
        }
    }
    time[id] += l - nowtime;
    if(time[id] > timemax) {
        timemax = time[id];
        timemaxid = id;
    }
    cout << timemaxid << "\n";
}