#include <iostream>
using namespace std;
int main() {
    cin.tie(NULL);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    pair<int, int> a[N];
    for (int i = 0; i < N; i++) cin >> a[i].first >> a[i].second;
    for (int i = 0; i < M; i++) {
        int l, r, x, b = 0;
        cin >> l >> r >> x;
        for (int j = l - 1; j < r; j++) if (x >= a[j].first and x <= a[j].second) b++;
        cout << b << '\n';
    }
    return 0;
}