#include <iostream>
using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	int d[N], u[N], l[M], r[M], x[M], i, j, count = 0;
	
	for (i = 0; i < N; i++) {
		cin >> d[i] >> u[i];
	}
	
	for (i = 0; i < M; i++) {
		cin >> l[i] >> r[i] >> x[i];
	}
	
	for (i = 0; i < M; i++) {
		count = 0;
		
		for (j = l[i] - 1; j <= r[i] - 1; j++) {
			if (x[i] >= d[j] && x[i] <= u[j]) count++;
		}
		
		if (i != 0) cout << endl << count;
		else cout << count;
	}
	
	return 1;
}