#include <iostream>
using namespace std;
//typedef long long int;
int main()
{
	int N, M;
	cin >> N >> M;
	int d[200001], u[200001], l, r, x, rez[200001];
	for (int i = 0; i < N; i++)
	{
		cin >> d[i] >> u[i];
	}
	for (int i = 0; i < M; i++)
	{
		cin >> l >> r >> x;
		rez[i] = 0;
		for (int j = l-1; j < r; j++)
		{
			if (d[j] <= x && u[j] >= x)  rez[i]++;
		}
	}
	for (int i = 0; i < M; i++)
	{
		cout << rez[i] << endl;
	}

	return 0;
}