#include <bits/stdc++.h>

using namespace std;

int main() {
    long long n, m;
    cin >> n >> m;
    
    vector <long long> donja_g(n);
    vector <long long> gornja_g(n);
    
    for(long long i = 0; i < n; i++)
        cin >> donja_g[i] >> gornja_g[i];
        
    for(long long i = 0; i < m; i++) {
        long long l, d, x;
        cin >> l >> d >> x;
        
        long long br = 0;
        
        for(long long j = l - 1; j <= d-1; j++)
            if(donja_g[j] <= x && x <= gornja_g[j])
                br++;
                
        cout << br << endl;
    }
    
    return 0;
}