#include <iostream>
using namespace std;

int main()
{
    int v, p, vv[20000][2];
    cin >> v >> p;
    for (int i = 0; i < v; i++)
    {
        cin >> vv[i][0] >> vv[i][1];
    }
    int l, d, tz, a[20000], g=0;
    for (int i = 0; i < p; i++)
    {
        cin >> l >> d >> tz;
        for (int j = l - 1; j < d; j++)
        {
            if (tz <= vv[j][1] && tz >= vv[j][0]) g++;
        }
        a[i] = g; g = 0;
    }
    for (int i = 0; i < p; i++) cout << a[i] << endl;
}