#include <bits/stdc++.h>

using namespace std;

struct vaga{
    long long int minimum;
    long long int maximum;
};

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int n, m;
    cin>>n>>m;
    vaga vage[n+1];
    for(long long int i=1;i<=n;i++)
        cin>>vage[i].minimum>>vage[i].maximum;

    long long int l, r, x;
    long long int b;
    while(m--){
        cin>>l>>r>>x;
        b=0;
        for(l;l<=r;l++){
            if(x >= vage[l].minimum && x <= vage[l].maximum)
                b++;
        }
        cout<<b<<"\n";
    }
    return 0;
}