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

int og1[200000], og2[200000], od[200000], doo[200000], x[200000];

int main(){

    int n, m;

    cin >> n >> m;

    for(int i=0; i<n; i++){
        cin>>og1[i]>>og2[i];
    }
    for(int i=0; i<m; i++){
        cin>>od[i]>>doo[i]>>x[i];
    }
    for(int i=0; i<m; i++){
        int brojac=0;
        for(int j=od[i]-1; j<=doo[i]-1; j++){
            if(x[i]>=og1[j] && x[i]<=og2[j])
                brojac++;
        }
        cout << brojac << endl;
    }



}