#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int vage, pitalice;
    bool p = 0;
    
    cin >> vage >> pitalice;
    
    vector<int> a(vage);
    vector<int> b(vage);
    
    for(int i = 1;i <= vage;i ++)
    {
        cin >> a[i] >> b[i];
    }
    
    for(int i = 1;i <= pitalice;i ++)
    {
        int dole, gore, tezina, brojac = 0;
        
        cin >> dole >> gore >> tezina;
        
        for(int j = dole;j <= gore;j ++)
        {
            if(a[j] <= tezina && b[j] >= tezina)
            {
                brojac++;
            }
        }
        
        cout << brojac << endl;
    }

    return 0;
}