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

int main(){
	vector < pair < int, int > > vage;
	int n, m, di, ui, li, ri, xi;
	vector<int>tezine;
	vector<pair<int,int> > granice;
	int counter = 0; vector<int>rezultati;
	cin >> n >> m;
	
	for (int i = 0; i < n; ++i){
		cin >> di >> ui;
		vage.push_back(make_pair(di, ui));
	}
	
	for(int i = 0; i < m; ++i){
		cin >> li >> ri  >> xi;
		granice.push_back(make_pair(li,ri));
		tezine.push_back(xi);
	}
	
	
	for(int i = 0; i < m; ++i){
		for(int tmp = granice[i].first-1;tmp < granice[i].second;++tmp){
			if(vage[tmp].first < tezine[i] + 1 && vage[tmp].second + 1 > tezine[i]){
				counter++;
			}
		}
	rezultati.push_back(counter);
	counter = 0;	
	}
	
	for(int i = 0; i < rezultati.size(); ++i){
		cout << rezultati[i] << endl;
	}
}