#include <bits/stdc++.h>
using namespace std;

int n, m;
int vage[200005][2];
int l, r, x;

int fitsDesc = 0;

int main()
{
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= n; ++i)
	{
		scanf("%d %d", &vage[i][0], &vage[i][1]);
	}
	for (int i = 0; i < m; ++i)
	{
		scanf("%d %d %d", &l, &r, &x);
		fitsDesc = 0;
		for (int j = l; j <= r; ++j)
		{
			if (vage[j][0] <= x && vage[j][1] >= x)
			{
				++fitsDesc;
			}
		}
		printf("%d\n", fitsDesc);
	}
	return 0;
}