#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int solve(int l, int r, int x, vector<int> d, vector<int> u) {
	int n = 0;
	for (int i = l; i <= r; i++) {
		if (x >= d[i] && x <= u[i])
			n++;
	}
	return n;
}

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