#include <iostream>
using namespace std;

int main()
{
    long n, m;
    cin >> n;
    cin >> m;
    long d[n], g[m];
    for (int i = 1;i <= n;i++)
    {
        cin >> d[i] >> g[i];
    }
    long li[m], ri[m], xi[m];
    for (int i = 1;i <= m;i++)
    {
        cin >> li[i] >> ri[i] >> xi[i];
    }
    long suma[200]={0};
    for (int i = 1;i <= m;i++)
    {
        for (int j = li[i];j <= ri[i];j++)
        {
            if (xi[i] >= d[j] && xi[i] <= g[j])suma[i]++;
        }
    }
    for (int i = 1;i <= m;i++)
    {
        cout << suma[i] << endl;
    }

    return 0;
}