#include <iostream>
using namespace std;
int main(int argc, char** argv) {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	pair <int,int> par[200002];
	cin>>n>>m;
	for (int i=0;i<n;i++){
		cin>>par[i].first>>par[i].second;
	}
	int l,d,x,brojac=0;
	for (int i=0;i<m;i++){
		cin>>l>>d>>x;
		brojac=0;
		for (int idot=l-1;idot<d;idot++){
			if ((par[idot].first<=x) and (par[idot].second>=x)) brojac++;
//			cout<<par[idot].first<<" "<<par[idot].second<<'\n';
		}
		cout<<brojac<<'\n';
	}
	
	return 0;
}