#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], l[m], r[m], x[m];
for( int i = 0; i < n; i++ ){
    cin >> d[i] >> u[i];
}
for ( int j = 0; j < m; j++ ){
    cin >> l[j] >> r[j] >> x[j];
    long long br = 0;
    for ( int k = l[j]; k <= r[j]; k++ ){
        if ( d[k] <= x[j] <= u[k] ){
            br++;
        }
    }
    cout << br << endl;
}