#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> donja(n);
    vector<int> gornja(n);

    for(int i = 0; i < n; i++){
        cin >> donja[i] >> gornja[i];
    }

    for(int i = 0; i < m; i++){
        int l, r, x, brojac = 0;
        cin >> l >> r >> x;
        l--;
        r--;

        for(int i = l; i <= r; i++){
            if(x <= gornja[i] && x >= donja[i])brojac++;
        }

        cout << brojac << endl;
    }
}