#include <bits/stdc++.h>
using namespace std;
long long n,m,d[200005],u[200005],target,levi,desni,br;
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
   cin>>d[i]>>u[i];
}
for(int i=1;i<=m;i++){
   cin>>levi>>desni>>target;
   br=0;
   while(levi<=desni){
      if(target>=d[levi] && target<=u[levi]){
         br++;
      }
      levi++;
   }
   cout<<br<<endl;
}




return 0;
}