#include <iostream>

using namespace std;

const int MaxN = 200001;
int d[MaxN], u[MaxN], l[MaxN], r[MaxN], x[MaxN];

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