#include <iostream>
#define maxN 20000

using namespace std;

int main()
{
    unsigned short n, m, i, l, r, j, uk[maxN] = {0};
    unsigned int d[maxN], u[maxN], x;
    cin >> n >> m;
    for (i = 0; i < n; i ++ )
    {
        cin >> d[i] >> u[i];
    }
    for ( i = 0; i < m; i ++ )
    {
        cin >> l >> r >> x;
        for ( j = l - 1; j < r; j ++ )
        {
            if (x <= u[j] && x >= d[j])
            {
                uk[i] ++;
            }
        }
    }
    for ( i = 0; i < m; i ++ )
        cout << uk[i] << endl;
    return 0;
}