#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define LPRINT(a, b) for (auto&(a) : (b))
#define li(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
#define lij(i,a,b) for (int (i) = (a); (i) <= (b); (i)++)


int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n,m;
cin>>n>>m;
vector<int> d(n),u(n),l(m),r(m),x(m);
for(int i = 0; i<n; i++){
	cin>>d[i]>>u[i];
}
for(int i = 0; i<m; i++){
	cin>>l[i]>>r[i]>>x[i];
}

for(int i = 0; i<m; i++){
	int res = 0;
	for(int j = l[i]-1; j<=r[i]-1; j++){
		if(x[i]<=u[j]&&x[i]>=d[j])res++;
	}
	cout<<res<<endl;
}
return 0;
}