N, R, L = gets.split.map(&:to_i)
time = Array.new(N, 0)
score = Array.new(N, 0)
lastTime = 0
topScore = 0
topTeam = 0
R.times do
  d, t, x = gets.split.map(&:to_i)
  d -= 1
  time[topTeam] += t - lastTime
  score[d] += x
  case d
    when topTeam
      if x >= 0
        topScore = score[d]
      else
        topScore = score.max
        topTeam = score.index(topScore)
      end
    else
      if x >= 0
        if score[d] == topScore
          topTeam = [d, topTeam].min
        elsif score[d] > topScore
          topScore = score[d]
          topTeam = d
        end
      else
      end
  end
  lastTime = t
end
time[topTeam] += L - lastTime
p time.index(time.max) + 1