#include <iostream>
using namespace std;
unsigned long long int d = 0, g = 0, br = 0, score = 0, N, M;

int main()
{
	cin >> N >> M;
	unsigned long long 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++)
	{
		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;
		score = 0;
	}
	for (int i = 0; i < M; i++)
	{
		cout << res[i] << endl;
	}
}