#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
}
int main()
{
   int N,M;
   cin >> N >> M;
   vector<vector<int>> nums(N);
   vector<vector<int>> questions(M);
   for(int i=0;i<N;i++){
        nums[i].push_back(0);
        nums[i].push_back(0);
        nums[i].push_back(0);
       cin  >> nums[i][0]  >> nums[i][1];
       nums[i][2] = i+1;
   }
   for(int i=0;i<M;i++){
       questions[i].push_back(0);
       questions[i].push_back(0);
       questions[i].push_back(0);
       cin  >> questions[i][0]  >> questions[i][1] >> questions[i][2];
   }
   int count;
   for(int i=0;i<M;i++){
       count = 0;
   for(int j=questions[i][0]-1;j<questions[i][1];j++){
       if((questions[i][2]>=nums[j][0]) && (questions[i][2]<=nums[j][1])){
           count++;}
   }
   cout << count << endl;
}}