#include <iostream>

using namespace std;

int main()
{
    int N,M,l,r,x;
    scanf("%d%d",&N,&M);
    int d[N],u[N];
    int i;
    for (i = 0; i < N; i++)
    {
        scanf("%d%d",&d[i],&u[i]);
    }
    int j = 0, br = 0;
    for (i = 0; i < M; i++)
    {
        br = 0;
        scanf("%d%d%d",&l,&r,&x);
        for (j = l - 1; j <r; j++)
        {
            if (x >= d[j] && x <= u[j]) br++;
        }
        printf("%d\n",br);
    }


    return 0;
}