#include<iostream>
#include<vector>
#include<utility>
using namespace std;

int main(){
std::ios_base::sync_with_stdio(false);
cin.tie(NULL);
unsigned int n,m,i;
cin>>n>>m;
vector<pair<int,int>> a;
vector<int> rez;
for(i=0;i<n;i++){
    int x,y;
    cin>>x>>y;
    a.push_back(make_pair(x,y));
}
for(i=0;i<m;i++){
    int x,y,z,j,br=0;
    cin>>x>>y>>z;
    for(j=x-1;j<=y-1;j++){
        if(z>=a[j].first&&a[j].second>=z)
        {
            br++;
        }
    }
    rez.push_back(br);

}
for(int i=0;i<rez.size();i++){
    cout<<rez[i]<<"\n";
}
return 0;
}