#include <iostream>
using namespace std;

struct vaga {
    int donja, gornja;
};
struct pitanja {
    int l, r, x;
};
int main()
{
    int n, m;
    cin >> n >> m;
    vaga* nVaga = new vaga[n];
    pitanja mPitanja;
    int* odgovor = new int[m];
    for (int i = 0; i < n; i++) {
        cin >> nVaga[i].donja >> nVaga[i].gornja;
    }
    for (int i = 0; i < m; i++) odgovor[i] = 0;
    for (int i = 0; i < m; i++) {
        cin >> mPitanja.l >> mPitanja.r >> mPitanja.x;

        for (int j = mPitanja.l; j <= mPitanja.r; j++) {
            if (nVaga[j-1].donja <= mPitanja.x && nVaga[j-1].gornja >= mPitanja.x)odgovor[i]++;

        }

    }
    for (int i = 0; i < m; i++) {
        cout << odgovor[i]<<"\n";
    }
    delete[]odgovor;
    delete[]nVaga;
}