#include <iostream>

using namespace std;

int main()
{
    int n, m, i = 0;
    cin >> n >> m;
    
    int vage[n][2];
    int pitanja[m][3];
    
    for (i = 0; i < n; i++)
    {
        cin >> vage[i][0];
        cin >> vage[i][1];
    }
    
    for (i = 0; i < m; i++)
    {
        cin >> pitanja[i][0];
        cin >> pitanja[i][1];
        cin >> pitanja[i][2];
    }
    
    for (i = 0; i < m; i++)
    {
        int C = pitanja[i][0];
        int counter = 0;
        int CS = 0;
        while ((C + counter) <= pitanja[i][1])
        {
            if (vage[C + counter][0] <= pitanja[i][2] && vage[C + counter][1] >= pitanja[i][2]){
                CS++;
            }
            counter++;
        }
        cout << CS << endl;
    }
    
}