#include<bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector<pair<int,int>> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i].first >> a[i].second;
    }
    while(m--){
        int l,r,x;
        int rez = 0;
        cin >> l >> r >> x;
        for(int i = l-1; i <= r-1; i++){
            if(a[i].first <= x && x <= a[i].second){
                rez++;
            }
        }
        cout << rez << endl;
    }
}