#include <bits/stdc++.h>

using namespace std;

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int N, M;
	cin>>N>>M;
	
	int lower[N], upper[N];
	
	for(int i = 0; i < N; i++) cin>>lower[i]>>upper[i];
	
	for(int i = 0; i < M; i++){
		int from, to, val;
		cin>>from>>to>>val;
		
		int _N = to - from + 1;
		int lClone[_N], uClone[_N];
		copy(lower + (from - 1), lower + (to), lClone);
		copy(upper + (from - 1), upper + (to), uClone);
		sort(lClone, lClone + _N);
		sort(uClone, uClone + _N);
		
		int lowerBound = lower_bound(uClone, uClone + _N, val) - uClone;
		int upperBound = upper_bound(lClone, lClone + _N, val) - lClone;
		
		cout<<abs(upperBound - lowerBound)<<endl;
	}
	
	return 0;
}