#include <iostream>
#include<algorithm>
#include<string>
#include <vector>

using namespace std;

struct vaga
{
    int minTezina;
    int maxTezina;
};

int main()
{
    int n, m;

    cin >> n >> m;

    vector<vaga> vage;

    for(int i = 0; i < n; i++)
    {
        vaga privremena;
        cin >> privremena.minTezina >> privremena.maxTezina;
        vage.push_back(privremena);
    }

    for(int i = 0; i < m; i++)
    {
        int a, b, tezina;
        int brojac = 0;

        cin >> a >> b >> tezina;

        for(int j = a - 1; j <= b - 1; j++)
        {
            if(tezina <= vage[j].maxTezina && tezina >= vage[j].minTezina)
            {
                brojac++;
            }
        }

        cout<<brojac << endl;
    }

    return 0;
}