#include <bits/stdc++.h>

using namespace std;

struct Vaga
{
    int okle,dokle;
};

void rijesi(vector<Vaga>& vage, int& l, int& r, int& x)
{
    l--;
    r--;
    int ans=0;
    while(l<=r)
    {
        if(x>=vage[l].okle && x<=vage[l].dokle)
            ans++;
        l++;
    }
    cout<<ans<<"\n";
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n,m;
    cin>>n>>m;
    vector<Vaga> vage(n);
    int i;
    for(i=0; i<n; i++)
        cin>>vage[i].okle>>vage[i].dokle;
    int l,r,x;
    while(m--)
    {
        cin>>l>>r>>x;
        rijesi(vage,l,r,x);
    }

    return 0;
}