// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <cstring>

#include <cstdlib>

#include <cmath>

#include <vector>

#include <string>

#include <map>

#include <set>

#include <queue>

#include <stack>

#include <algorithm>



using namespace std;



#define rep(i,j) REP((i), 0, (j))

#define REP(i,j,k) for(int i=(j);(i)<(k);++i)

#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))

#define ALL(v) (v).begin(), (v).end()

#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))

#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)

#define MP make_pair

#define PB push_back

#define F first

#define S second

#define INF 1 << 30

#define EPS 1e-10

#define MAX_N 200000



typedef long long ll;

typedef pair<ll, ll> P;

typedef pair<int, P> pii;

typedef vector<int> vi;

typedef queue<int> qi;



struct segtree{

  int N;

  P dat[2 * MAX_N - 1];

  segtree(){}

  segtree(int n){

    N = 1;

    while(n > N) N *= 2;



    rep(i, 2 * N - 1) dat[i] = MP(-10000000, -10000000);

    for(int i = N - 1; i < 2 * N - 1; i++) dat[i] = MP(0, -1 * (i - N + 1));

  }



  void update(int k, int a){

    k += N - 1;

    dat[k].F += a;

    while(k > 0){

      k = (k - 1) / 2;

      dat[k] = max(dat[k*2+1], dat[2*k+2]);

    }

  }



  P query(int a, int b){ return query(a, b, 0, 0, N); }

  P query(int a, int b, int k, int l, int r){

    if(r <= a || b <= l) return P(-10000000, -10000000);



    if(a <= l && r <= b) return dat[k];

    else{

      P vl = query(a, b, 2*k+1, l, (l+r)/2);

      P vr = query(a, b, 2*k+2, (l+r)/2, r);

      return max(vl, vr);

    }

  }

};



int res[MAX_N];



int main(){

  int N, R, L;

  scanf("%d%d%d", &N, &R, &L);

  segtree seg(N);

  rep(i, N) seg.update(i, 0);



  int time = 0;

  rep(i, R){

    int d, t, x;

    scanf("%d%d%d", &d, &t, &x); d--;

    P s = seg.query(0, N);

    res[-s.second] += t - time;

    seg.update(d, x);

    time = t;

  }

  P s = seg.query(0, N);

  res[-s.second] += L - time;



  int ans = 0;

  rep(i, N) if(res[ans] < res[i]) ans = i;



  printf("%d\n", ans+1);

  return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <queue>

#include <algorithm>



using namespace std;



#define rep(i,j) REP((i), 0, (j))

#define REP(i,j,k) for(int i=(j);(i)<(k);++i)

#define MP make_pair

#define F first

#define S second



typedef pair<int, int> P;



int N, R, L;

int point[100005];

int res[100005];



int main(){

  scanf("%d%d%d", &N, &R, &L);

  int now = 0;



  priority_queue<P>q;

  rep(i, N) q.push(P(0, -i));

  rep(i, R){

    //    printf("%d\n", i);



    int d, t, x;

    scanf("%d%d%d", &d, &t, &x);d--;

    //    printf("%d %d %d\n", d, t, x);



    //    printf("%d\n", i);

    P p = q.top(); q.pop();

    while(p.F != point[-p.S]){

      p = q.top(); q.pop();

    }

    q.push(p);



    res[-p.S] += t - now;

    now = t;



    point[d] += x;

    //    printf("%d\n", d);

    //    rep(j, N) printf("%d ", point[j]); puts("");

    q.push(P(point[d], -d));

  }



  P p = q.top(); q.pop();

  while(p.F != point[-p.S]){

    //    printf("%d %d\n", p.F, point[-p.S]);

    p = q.top(); q.pop();

  }

  //  printf("%d %d\n", p.F, point[-p.S]);

  res[-p.S] += L - now;



  //  rep(i, N) printf("%d ", res[i]); puts("");

  int team = 0;

  rep(i, N) if(res[team] < res[i]) team = i;

  printf("%d\n", team+1);

  exit(0);

  return (0);

}

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

 

 

}