#include <iostream>
#include <vector>

using namespace std;
vector<pair<int,int>> vaga;
int main()
{
    int N,M;
    int d,u;
    int l,r,x;
    cin >> N;
    cin >> M;
    for(int i = 0;i < N; i++){
        cin >> d;
        cin >> u;
        vaga.push_back(make_pair(d,u));
    }for(int i = 0;i <M;i++){
        cin >>l;
        cin >>r;
        cin >>x;
        int br=0;
    for (int a = l-1; a <= r-1;a++){
        if (vaga[a].first <= x){
        if(vaga[a].second >= x)
            br++;
        }
    }
        cout <<br<<endl;
    }
    return 0;
}