#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int N,M,l,r,x;
    cin>>N>>M;
    vector<pair<int,int>> weights(N);
    for(int i=0;i<N;i++)
        cin>>weights[i].first>>weights[i].second;
    for(int i=0;i<M;i++){
        cin>>l>>r>>x;
        vector<pair<int,int>> interval(r-l+1);
        interval=std::vector<pair<int,int>>(weights.begin()+l-1,weights.begin()+r);
        sort(interval.begin(),interval.end());
        int noScales=0;
        for(auto weight:interval)
            if(x>=weight.first && x<=weight.second)
                noScales++;
        cout<<noScales<<endl;
        interval.empty();
    }
	return 0;
}