#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;

pi vage[200001];

int main()
{
    int n,m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++){
        int di, ui;
        cin >> di >> ui;
        vage[i] = {di, ui};
    }
    while(m--){
        int l, r, x, br;
        cin >> l >> r >> x;
        br =0;
        for (int i = l; i <= r; i++){
            if(x >= vage[i].first && x <= vage[i].second)
                br++;
        }
        cout << br << endl;
    }

    return 0;
}