#include <bits/stdc++.h>
#define ff(i,a,b) for(int (i) = (a); (i) < (b); ++ (i))
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pic pair<int,char>
#define FF(i,a,b) for(int (i) = (a); (i) > (b); -- (i))
#define xx first
#define yy second
#define pb push_back
#define ll long long
#define pqq priority_queue
using namespace std;
struct vaga{
	int low;
	int high;
};
vaga vage[200007];
void solve(){
	long long l,r,x;
	cin>>l>>r>>x;
	long long ans = 0;
	for(int i = l;i<=r;i++){
		if(vage[i].low<=x and vage[i].high>=x)ans++;
	}
	cout<<ans<<endl;
}
int main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;cin>>n>>m;
	ff(i,1,n+1){
		cin>>vage[i].low>>vage[i].high;
	}
	while(m--)
    solve();
}