#include <iostream>

using namespace std;

int main()
{
    int n, m;

    cin >> n >> m;

    int d[n], u[n];

    int l[m], r[m], x[m];

    for(int i = 0; i < n; i++) cin >> d[i] >> u[i];

    for(int i = 0; i < m; i++){

        cin >> l[i] >> r[i];

        l[i] --;

        r[i] --;

        cin >> x[i];

    }

    for(int i = 0; i < m; i++){

        int res = 0;

        for(int j = l[i]; j <= r[i]; j++) if(x[i] >= d[j] && x[i] <= u[j]) res ++;

        cout << res << endl;

    }

    return 0;
}