#include <iostream>

using namespace std;

int main()
{
    int N, M, k = 0, m;
    cin >> N >> M;
    int d[N];
    int u[N];
    int l[M];
    int r[M];
    int x[M];
    for(int i = 0; i < N; i++)
    {
        cin >> d[i] >> u[i];
    }
    for(int i = 0; i < M; i++)
    {
        cin >> l[i] >> r[i] >> x[i];
    }
    for(int i = 0; i < M; i++)
    {
        for(int j = l[i]; j <= r[i]; j++)
        {
        if(d[j] <=  x[i] && x[i] <= u[j])
        {
            k++;
        }
            }
        cout << k << endl;
        k=0;
    }
}