#include <iostream>

using namespace std;

struct Vaga{
    int minimum, maximum;
};

struct Pitanja{
    int l, r, x;
};

int main()
{
    int n, m;
    cin >> n >> m;
    Vaga vaga[n];
    Pitanja pitanja[m];

    for(int i=0; i<n; ++i)
    {
        cin >> vaga[i].minimum >> vaga[i].maximum;
    }
    for(int i=0; i<m; ++i)
    {
        cin >> pitanja[i].l >> pitanja[i].r >> pitanja[i].x;
    }

    for(int i=0; i<m; ++i)
    {
        int broj = 0;
        for(int j=pitanja[i].l-1; j<=pitanja[i].r-1; ++j)
        {
            if(vaga[j].minimum <= pitanja[i].x && pitanja[i].x <= vaga[j].maximum)
                ++broj;
        }
        cout << broj << endl;
    }
}