#include <iostream>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#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 lis[100000];
int tim[100000];
int main() {
    int n,r,l;
    scanf("%d %d %d",&n,&r,&l);
    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;
        scanf("%d %d %d",&d,&t,&x);
        tim[id] += t - nowtime;
        if(tim[id] > timemax) {
            timemax = tim[id];
            timemaxid = id;
        }
        nowtime = t;
        lis[d] += x;
        if(id == d) {
            top += x;
        }
        if(x < 0 && d == id) {
            for(int j = 1; j < n+1; j++) {
                if(top < lis[j] || (top == lis[j] && j < id)) {
                    top = lis[j];
                    id = j;
                }
            }
            
        }
        if(x > 0 && d != id) {
            if(top < lis[d] || (top == lis[d] && d < id)) {
                top = lis[d];
                id = d;
            }
        }
    }
    tim[id] += l - nowtime;
    if(tim[id] > timemax) {
        timemax = tim[id];
        timemaxid = id;
    }
    printf("%d\n",timemaxid);
}