#include <iostream>

using namespace std;

int main()
{
    long long n,m, s;
    cin >> n >> m;
    long long d[n], u[n],l[m],r[m],x[m];
    for(long long i = 0; i < n; i++)
    {
        cin >> d[i] >> u[i];
    }
    for(long long i = 0; i < m; i++)
    {
        cin >> l[i] >> r[i] >> x[i];
    }
    for(long long i = 0; i < m; i++)
    {
        s = 0;
        for(long long j = l[i] - 1; j <= r[i] - 1; j++)
        {
            if(d[j] <= x[i] && x[i] <= u[j])
            {
                s+= 1;
            }
        }
        cout << s << endl;
    }
}