#include<iostream>
using namespace std;
int main(){
int n;
int m;
cin>>n>>m;


int a[n+1],b[n+1];
for(int i=1;i<=n;i++)
	cin>>a[i]>>b[i];
for(int j=1;j<=m;j++){
	int l,r,x;
	cin>>l>>r>>x;
	int k=0;
	for(int j=l;j<=r;j++){
		if(a[j]<=x and x<=b[j]){
			k=k+1;
		}
	
	}
	cout<<k<<"\n";
				
}


}