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

int main(){
    int N, M, d, u, l, r, x;
    cin >> N >> M;
    vector <int> D;
    vector <int> U;
    vector <int> L;
    vector <int> R;
    vector <int> X;
    for(int i = 0; i < N; i++){
        cin >> d >> u;
        D.push_back(d);
        U.push_back(u);
    }
    for(int i = 0; i < M; i++){
        cin >> l >> r >> x;
        L.push_back(l);
        R.push_back(r);
        X.push_back(x);
    }
    for(int i = 0; i < M; i++){
        int br=0;
        for(int j = L[i]; j <= R[i]; j++){
             if((X[i] <= U[j]) && (X[i] >= D[j])){
                br++;
             }
        }

        cout << br << "\n";
    }
}