#include <iostream>
#include <vector>
#include <utility>
using namespace std;
struct pitanja 
{
	int l,r,x;
};
 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	int n,m,z;
	z=0;
	cin >> n >> m;
	vector<pair<int, int> >a(n);
	for(int i = 0; i < n; i++)
	{
		cin >> a[i].first >> a[i].second;
		
	}
	vector<pitanja>b(m);
	for(int i = 0; i<m; i++)
	{
		cin >> b[i].l >> b[i].r >> b[i].x;
	}
	for(int i = 0; i<m; i++)
	{
		z = 0;
		for(int j = (b[i].l)-1; j<=(b[i].r)-1; j++)
		{
			if(a[j].first<=b[i].x&&a[j].second>=b[i].x)
			{
				z++;
			}
		}
		cout << z << endl;
	}
	
	
	return 0;
}