#include <iostream>

using namespace std;

void prebrojavanje(int x, int l, int r, int d[], int u[])
{
    int res = 0;

    for(int j = l-1; j < r; j++)
        {
            if(x >= d[j] && x <= u[j]) res++;
        }
    cout << res << endl;

    res = 0;

}

int main()
{
    int n, m;

    cin >> n >> m;

    int d[n], u[n];

    for(int i = 0; i < n; i++) cin >> d[i] >> u[i];

    int l[m], r[m], x[m];

    for(int i = 0; i < m; i++) cin >> l[i] >> r[i] >> x[i];

    for(int i = 0; i < m; i++)
    {
        prebrojavanje(x[i], l[i], r[i], d, u);
    }
    return 0;
}