#include<bits/stdc++.h>
using namespace std;

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	int N, M; cin >> N >> M;
	int d[N+1], u[N+1];
	int l[M+1], r[M+1], x[M+1];
	
	for(int i = 1; i <= N; i++){
		cin >> d[i] >> u[i];
	}
	for(int i = 0; i < M; i++){
		cin >> l[i] >> r[i] >> x[i];
		int res = 0;
		for(int j = l[i]; j <= r[i]; j++){
			if(max(d[j], x[i]) == x[i] && min(u[j], x[i]) == x[i]){
				//cerr << d[j] << " ||| " << u[j] << " ||| " << x[i] << endl;
				res++;
			}
		}
		cout << res << endl;
	}
	return 0;
}