#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    vector<pair<unsigned long long, unsigned long long>> tezine (n);
    for(int i = 0; i < n; i++){
        unsigned long long d, u;
        cin >> d >> u;
        tezine[i] = make_pair(d, u);
    }
    for(int i = 0; i < m; i++){
        int l, r;
        cin >> l >> r;
        unsigned long long x;
        cin >> x;
        if(l == r){
            if(x >= tezine[l - 1].first && x <= tezine[l - 1].second){
                cout << 1 << '\n';
            }
        }
        else{
            vector<int> dp (r + 1);
            dp[0] = 0;
            for(int i = 1; i <= r; i++){
                if(x >= tezine[i - 1].first && x <= tezine[i - 1].second){
                    dp[i] = dp[i - 1] + 1;
                }
                else{
                    dp[i] = dp[i - 1];
                }
            }
            cout << dp[r] - dp[l - 1] << '\n';
        }
    }
    
}