#include <iostream>
#include <set>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>
#include <queue>
#include <cmath>
#include <iomanip>
#include <utility>
#define pb push_back
#define ll long long
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
// Milovan > Aleksamaster
ll mod=1e9+7;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,k;
	cin>>n>>k;
	pair<int,int>a[n+1];
	for(int i=1;i<=n;i++)cin>>a[i].first>>a[i].second;
	while(k--){
		int l,r,c;
		cin>>l>>r>>c;
		int ans=0;
		for(int i=l;i<=r;i++){
			if(a[i].first<=c&&a[i].second>=c)ans++;
		}
		cout<<ans;
		cout<<endl;
	}
}