#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
struct vaga
{
	int u, d;
};
int main()
{
	int n, m, l, r, x, br;
	cin >> n >> m;
	vaga* a;
	a = new vaga[n];
	queue<int>rez;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i].d >> a[i].u;
	}
	for (int i = 0; i < m; i++)
	{
		br = 0;
		cin >> l >> r >> x;
		l--;
		r--;
		for (int j = l; j <= r; j++)
		{
			if (x >= a[j].d && x <= a[j].u) br++;
		}
		rez.push(br);
	}
	while (!rez.empty())
	{
		cout << rez.front() << endl;
		rez.pop();
	}
	return 0;
}