#include <iostream>
#include<vector>
using namespace std;
struct vaga{
int mint;
int maxt;
};
int main()
{
    int n,q;
    cin>>n>>q;
    vector<vaga>vage(n);
    vector<int> odg(q);
    for(int i=0;i<n;i++)
        cin>>vage[i].mint>>vage[i].maxt;
    for(int i=0;i<q;i++)
        {
            int br=0;
            int index1,index2,tezina;
            cin>>index1>>index2>>tezina;
            index1--;
            index2--;
            while(index1<=index2)
            {
                if(tezina>=vage[index1].mint && tezina<=vage[index1].maxt)
                    br++;
                index1++;
            }
            odg[i]=br;
        }
        for(int i=0;i<q;i++)
            cout<<odg[i]<<endl;
    return 0;
}