// Original C++ solution (slower):
#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";

}

// Optimized solution to the same problem (faster):


#include <cstdio>





using namespace std;

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);

}

// Fastest known solution for this problem:
#include <iostream>

#include<algorithm>

#include<cassert>

using namespace std;



int main(){



 int N,R,L;

 int INF = 1e9;



 cin >> N >> R >> L;





 pair <int,int>  score[200005];

 int time[100005];

 for(int i=1;i<200005;i++)score[i]=make_pair(INF,-1);

 int id[200005] = {};

 for(int i=1;i<=N;i++) {

   score[i]=make_pair(0,i);

   id[i] = i;

   time[i] = 0;

 }

 

 int  mae = 0;

 

 int d,t,x;

 for(int i=0;i<R;i++) {

   cin >> d >> t >> x;



 int site1 = id[d];

   assert(site1>=1);

   

   time[score[1].second] += t - mae;

   score[site1].first -= x;

   mae = t;



   if(x>0){ 

     while(site1>1) {

       if(score[site1] < score[site1/2] ) {

	 swap(score[site1], score[site1/2]);

	 id[score[site1].second]= site1;

	 id[score[site1/2].second] = site1/2;

       site1 = site1/2;

     } else break;

     }

   }

   else {

     while(1) {

       if( score[2*site1] < score[site1] || score[2*site1+1] < score[site1]) {

	 int flg = 0;

	 if(score[2*site1] > score[2*site1+1]) flg = 1;

	 swap(score[site1],score[2*site1+flg]);

	 id[score[site1].second] = site1;

	 id[score[2*site1+flg].second] = 2*site1+flg;

	 site1 = 2*site1+flg;

       }else break;

     }

   }

   /*    for(int j=1;j<=N;j++) cout<<score[j].second;

	 cout << endl;

	 for(int j=1;j<=N;j++) cout <<score[j].first <<" ";

	 cout << endl;

	 for(int j=1;j<=N;j++) cout <<time[j] << " ";

	 cout << endl;

   */

 }

 



 time[score[1].second] += L-mae;

 

 int maxtime = -1;

 int ans;

 for(int i=1;i<=N;i++) 

   if(maxtime < time[i]) maxtime = time[i] ,ans = i;



 // for(int i=1;i<=N;i++) cout << time[i] <<" ";

 //cout << endl;

 

 cout << ans << endl;



 return 0;

 

 

}