#include <iostream>
using namespace std;
const int  MaxN = 200001;
int d[MaxN], u[MaxN], l[MaxN], r[MaxN], x[MaxN];
int main()
{
    int n, m, levo, desno,q;
    cin >> n >> m;
    for (int i = 1;i <= n;i++)
    {
        cin >> d[i] >> u[i];
    }
    for (int i = 1;i <= m;i++)
    {
        cin >> l[i] >> r[i] >> x[i];
    }
    for (int i = 1;i <= m;i++)
    {
        q = 0;
        levo = l[i];
        desno = r[i];
        while (levo <= desno)
        {
            if (d[levo] <= x[i] && u[levo] >= x[i])
            {
                q++;
            }
            levo++;
        }
        cout << q << endl;
    }
    return 0;
}