#include <iostream>

using namespace std;

int main(){
	int n, m, c;
	cin >> n >> m;
	int d[n], u[n], l[m], r[m], x[m];
	
	for (int i = 0; i < n; i++){
		cin >> d[i] >> u[i];
	}
	for (int i = 0; i < m; i++){
		cin >> l[i] >> r[i] >> x[i];
	}
	
	for (int i = 0; i < m; i++){
		int c = 0;
		for (int j = l[i]; j <= r[i]; j++){
			if ((d[j] <= x[i] ) and (x[i] <= u[j])){
				c++;
			}
		}
		cout << c << endl;
	}
}