### BUGGY CODE ###

# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0282

"""
import sys
from sys import stdin
input = stdin.readline


class RMQ(object):
    INT_MAX = 2**31 - 1

    def __init__(self, nn, init_val=0):
        self.n = 1
        while self.n < nn:
            self.n *= 2
        self.dat = [init_val] * ((2 * self.n)-1)

    def update(self, k, a):
        # A[k]???a?????´??°?????????????????°???????????¨?????´??°
        k += (self.n - 1)
        self.dat[k] = a

        while k > 0:
            k = (k - 1) // 2        #  ??????index??????
            self.dat[k] = min(self.dat[k * 2 + 1], self.dat[k * 2 + 2]) #  ???????????¨??????????????????????°?????????????????????´??°

    def query(self, a, b, k, l, r):
        # [a, b)???????°????????±??????? (0????????§b???????????????)
        # ??????????????¨?????????query(a, b, 0, 0, n)?????¢??§??????????????????k, l, r???????????????????????´??°?????????
        if r <= a or b <= l:        #  ?????????????????§??¨??????????????????
            return RMQ.INT_MAX
        if a <=l and r <= b:
            return self.dat[k]           #  ???????????°???????????????????????§????????°????????¨??????????????????????°?????????????????????????
        else:
            vl = self.query(a, b, k*2+1, l, (l+r)//2) #  ????????°????????????????°????
            vr = self.query(a, b, k*2+2, (l+r)//2, r) #  ????????°????????????????°????
            return min(vl, vr)

    def find(self, s, t):
        return self.query(s, t+1, 0, 0, self.n)



def main(args):
    N, R, L = map(int, input().split(' '))
    on_tv = [0] * (N + 1)       #  ????????????????????¬???????????£??????????????????????¨?
    scores = [0] * (N + 1)       #  ????????????????????¨?????????
    scores[0] = float('-inf')

    rq = RMQ(N+1)

    last_time = 0
    for i in range(R):
        d, t, x = [int(x) for x in input().split(' ')]
        top_score = rq.find(1, N)
        top_team = scores.index(-top_score)
        on_tv[top_team] += (t - last_time)

        scores[d] += x
        rq.update(d, -scores[d])

        last_time = t

    t = L
    top_score = rq.find(1, N)
    top_team = scores.index(-top_score)
    on_tv[top_team] += (t - last_time)

    print(on_tv.index(max(on_tv)))


if __name__ == '__main__':
    main(sys.argv[1:])

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0282

"""
import sys
from sys import stdin
from heapq import heappop, heappush
input = stdin.readline


pq = []                         # list of entries arranged in a heap
entry_finder = {}               # mapping of tasks to entries
REMOVED = float('inf')      # placeholder for a removed task

def add_team(score, team):
    if team in entry_finder:
        remove_team(team)
    entry = [-score, team]
    entry_finder[team] = entry
    heappush(pq, entry)

def remove_team(team):
    entry = entry_finder.pop(team)
    entry[-1] = REMOVED

def pop_team():
    while pq:
        score, team = heappop(pq)
        if team is not REMOVED:
            del entry_finder[team]
            return score, team
    raise KeyError('pop from an empty priority queue')


def main(args):
    N, R, L = map(int, input().split(' '))
    on_tv = [0] * (N + 1)       #  ????????????????????¬???????????£??????????????????????¨?
    scores = [0] * (N + 1)       #  ????????????????????¨?????????

    #for i in range(1, N+1):
    #    add_team(0, i)
    
    add_team(0, 1)

    last_time = 0
    need_pop = True
    top_score = 0

    for i in range(R):
        d, t, x = [int(x) for x in input().split(' ')]
        if need_pop:
            need_pop = False
            top_score, team = pop_team()
            if d != team:
                add_team(scores[team], team)

        on_tv[team] += (t - last_time)

        scores[d] += x
        add_team(scores[d], d)
        if x > 0 and scores[d] > top_score:
            need_pop = True

        last_time = t

    t = L
    score, team = pop_team()
    on_tv[team] += (t - last_time)

    print(on_tv.index(max(on_tv)))


if __name__ == '__main__':
    main(sys.argv[1:])