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

#define ll long long
#define ull unsigned long long
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define FOR(i, n) for (int i = 0; i < n; ++i)
#define INF 0x3f3f3f3f
const vector<pair<int, int>> nb = {{-1, -1}, {-1, 1}, {1, 1}, {1, -1}, {-1, 0}, {1, 0}, {0, 1}, {0, -1}};
const vector<pair<int, int>> nc = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}};
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }
const int maxN = 200001;

int n,m;

void solve(){
	vector<pii> du(n);
	for(auto &i:du)cin>>i.first>>i.second;
	int l,r,x;
	while(m--){
		cin>>l>>r>>x;
		int cnt = 0;
		for(int i=l-1;i<r;++i){
			if(du[i].first <= x && du[i].second >= x)++cnt;
		}
		cout<<cnt<<"\n";
	}
}

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>m;
	solve();
	return 0;
}