#include<bits/stdc++.h>

using namespace std;

int main(int argc, char **argv){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    long N = 0, M = 0, u = 0, d = 0, l = 0, r = 0, x = 0, inkr = 0;
    vector<vector<long>> vage{{-123456789, -123456789}};

    cin >> N >> M;

    for(long i = 1; i <= N; i++){
        cin >> u >> d;
        vage.push_back({u, d});
    }

    for(long i = 1; i <= M; i++){
        inkr = 0;
        cin >> l >> r >> x;
        for(long m = l; m <= r; m++) if(vage[m][0] <= x && vage[m][1] >= x) ++inkr;
        cout << inkr << '\n';
    }
}