#include <iostream>
#include<vector>
using namespace std;
int main()
{
   int n,m,c;
   cin>>n>>m;
   vector<int>a(n);
 vector<int>b(n);
    vector<int>y(m);
 vector<int>x(m);
  vector<int>z(m);
  vector<int>r(m);
  for(int i=0;i<n;i++)cin>>a[i]>>b[i];
  //if(a[i]!=b[i])k=0;}
    for(int i=0;i<m;i++){cin>>x[i]>>y[i]>>z[i];
     c=0;
    for(int j=x[i];j<=y[i];j++){
        if(a[j]<=z[i]&&b[j]>=z[i])c++;
    }
    r[i]=c;
    }
     for(int i=0;i<m;i++)cout<<r[i]<<endl;
    return 0;
}