#include <iostream>
#include <algorithm>
using namespace std;

using int64 = int64_t;

struct Vaga
{
	int u, l;
};

Vaga vage[100000];

int main()
{
	int n, m;

	cin >> n >> m;
	
	for (int i = 0; i < n; ++i)
		cin >> vage[i].l >> vage[i].u;

	for (int i = 0; i < m; ++i)
	{
		int l, r, t;
		cin >> l >> r >> t;
		l--;
		r--;
		int c = 0;

		for (int j = l; j <= r; ++j)
			if (vage[j].l <= t && vage[j].u >= t)
				++c;

		printf("%i\n", c);
	}	
	
 	return 0;
}