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


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, m, z;
	unordered_map <int, pair <int, int>> v;
	cin >> n >> m;
	int l[m], r[m], x[m];
	for (int i = 0; i < n; i++){
		cin >> v[i + 1].first >> v[i + 1].second;
	}
	for (int i = 0; i < m; i++){
		cin >> l[i] >> r[i] >> x[i];
	}
	for (int i = 0; i < m; i++){
		z = 0;
		for (int j = l[i]; j <= r[i]; j++){
			if (v[j].first <= x[i] && v[j].second >= x[i]){
				z++;
			}
		}
		cout << z << "\n";
	}
    return 0;
}