#include <iostream>

using namespace std;

int main()
{
    int n,m,l,r,x,o;
    cin>>n>>m;
    int a[n];
    int b[n];
    for (int i = 0; i<n; i++)
        cin>>a[i]>>b[i];
    for (int i = 0; i<m; i++)
    {
        o=0;
        cin>>l>>r>>x;
        for (int j = l - 1; j<r; j++)
        {
            if (a[j] <= x && b[j] >= x)
                o++;
        }
        cout<<o<<endl;
    }

    return 0;
}