#include<bits/stdc++.h>
using namespace std;
struct vgranice{
	int donja, gornja;
};
struct granice{
	int brv1, brv2, tezina;
};
int main(){
	int n, m, br=0;
	cin>>n>>m;
	vector<vgranice>a(n);
	for(int i=0; i<n; i++){
		cin>>a[i].donja>>a[i].gornja;
	}
	vector<granice>b(m);
	for(int i=0; i<m; i++){
		cin>>b[i].brv1>>b[i].brv2>>b[i].tezina;
	}
	for(int i=0; i<m; i++){
		for(int j=0; j<n; j++){
			if(j>=b[i].brv1-1 && j<=b[i].brv2-1){
				if(b[i].tezina>=a[j].donja && b[i].tezina<=a[j].gornja)br++;	
			}
		}
		cout<<br<<"\n";
		br=0;
	}
}