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

int main(int argc, char**argv){
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
long long n, m; cin >> n >> m;
long long d[n], u[n];
for ( int i = 0; i < n; i++ ){
    cin >> d[i] >> u[i];
}
long long l[m], r[m], x[m];
for ( int i = 0; i < m; i++ ){
    cin >> l[i] >> r[i] >> x[i];
    long long f[r[i]+1];
    if (  d[0] <= x[i] <= u[0] ){
        f[0] = 1;
    }
    else{
        f[0] = 0;
    }
    for ( int j = 1; j < r[i]+1; j++ ){
        if ( d[j] <= x[i] <= u[j] ){
            f[j] = f[j-1] + 1;
        }
    }
    cout << f[r[i]] - f[l[i]] << endl;
}


return 0;
}