#include <iostream>

using namespace std;

typedef struct
{
	int g;
	int d;
} Mere;
int main()
{
	int n, m;
	cin >> n >> m;
	Mere a[n];
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i].d >> a[i].g;
	}
	int dg[m],gg[m],x[m];
	for(int i = 1; i <= m; i++)
	{
		cin >> dg[i] >> gg[i] >> x[i];
	}
	for(int i = 1; i <= m; i++)
	{
		int br = 0;
		for(int j = dg[i]; j <= gg[i]; j++)
		{
			if(x[i] <= a[j].g && x[i] >= a[j].d) br++;
		}
		cout << br << endl;
	}
	return 0;
}