#include <iostream>

using namespace std;

int main()
{
    int n, m;

    cin >> n >> m;

    int d[n], u[n];

    for(int i = 0; i < n; i++) cin >> d[i] >> u[i];

    int l[m], r[m], x[m];

    for(int i = 0; i < m; i++) cin >> l[i] >> r[i] >> x[i];

    int res = 0;

    for(int i = 0; i < m; i++)
    {
        for(int j = l[i]-1; j < r[i]; j++)
        {
            if(x[i] >= d[j] && x[i] <= u[j]) res++;
        }
        cout << res << endl;

        res = 0;
    }
    return 0;
}