#include<iostream>
#include<vector>

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;

	vector<int> d(n);
	vector<int> u(n);

	for (int i = 0; i < n ; i++) {
		cin >> d[i] >> u[i];
	}
	vector<int> l(m);
	vector<int> r(m);
	vector<int> x(m);

	for (int i = 0; i < m; i++) {
		cin >> l[i] >> r[i] >> x[i];
	}
	
	vector<int> brojac(m, 0);

	for (int i = 0; i < m; i++) {
		for (int j = l[i] - 1; j <= r[i] - 1; j++) {
			if ((x[i] >= d[j]) && (x[i] <= u[j])) {
				brojac[i]++;
			}
		}
	}

	for (int i = 0; i < m; i++) {
		cout << brojac[i] << endl;
	}
	
	return 0;

}