#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

/* 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;
	cin >> n >> m;
	long long dg[n];
	long long gg[n];
	bool t = true;
	for(int i = 0; i<n;i++)
	{
		cin >> dg[i] >> gg[i];
	}
	for(int i = 0; i<m;i++)
	{
		int s = 0;
		int l, d;
		long long x;
		cin >> l >> d >> x;
		for(int j = l-1; j<d;j++)
		{
			if(x>=dg[j] && x<=gg[j])
			{
				s++;
			}
		}
		cout << s << endl;
	}
	return 0;
}