#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int n, m; cin >> n >> m;
	vector<pair<int, int>> a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i].first >> a[i].second;
	}
	for (int i = 0; i < m; i++)
	{
		int l, r, x; cin >> l >> r >> x;
		int br = 0;
		for (int j = l-1; j < r; j++)
		{
			if (a[j].first <= x && a[j].second >= x) br++;
		}
		cout << br << endl;
	}
}