#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    
    vector<pair<int, int>> v;
    vector<tuple<int,int,int>> v1;
    v.resize(n);
    v1.resize(m);
    
    for(int i = 0; i < n; i++){
        unsigned int d,u;
        cin >> d >> u;
        v[i] = make_pair(d,u);
    }
    
    for(int i = 0; i < m; i++){
        int l,r;
        unsigned int x;
        cin >> l >> r >> x;
        v1[i] = make_tuple(l,r,x);
    }
    
    for(int i = 0; i < m; i++){
        int br = 0;
        for(int j = get<0>(v1[i])-1; j <= get<1>(v1[i])-1 ; j++){
            int x = get<2>(v1[i]);
            if(x>=v[j].first && x<=v[j].second){
                br++;
            }
        }
        cout << br <<"\n";
    }
    return 0;
}