#include <iostream>

using namespace std;

int main()
{
    long long int n, m;
    cin >> n >> m;

    long long int ns[n], nm[n];
    for(long long int i =0;i<n;i++)
        cin >> ns[i] >> nm[i];

    while(m!=0)
    {

        long long int l,r,x,br=0;
        cin >> l >> r >> x;
        l=l-1;
        r=r-1;

        for(long long int i =l;i<=r;i++)
        {
            if(ns[i] <=x && nm[i] >=x)
                br++;
            cout << br<< endl;
        }


        m--;
    }



    return 0;
}