#include <iostream>
using namespace std;
int main()
{
	int N, M;
	cin >> N >> M;
	int vage[N][N * 2], res[M];
	for (int i = 0; i < N; i++)
	{
		cin >> vage[i][0] >> vage[i][1];
	}
	for (int i = 0; i < M; i++)
	{
		int d = 0, g = 0, br = 0, score = 0;
		cin >> d >> g >> br;
		g--;
		d--;
		for (int i = d; i <= g; i++)
		{
			if (br >= vage[i][0] && br <= vage[i][1])
			{
				score++;
			}
		}
		res[i] = score;
	}
	for (int i = 0; i < M; i++)
	{
		cout << res[i] << endl;
	}
}