#include <stdio.h>
#include <stdlib.h>

struct pitanja
{
    int index_i;
    int index_j;
    int tezina;
};

struct granica
{
    int donja;
    int gornja;
};

int main()
{
    int n,m;
    scanf("%d",&n);
    scanf("%d",&m);
    int a,b,c;
    struct pitanja p[m];
    struct granica g[n];
    for(int i=1;i<=n;i++)
    {
        scanf("%d %d",&a,&b);
        g[i].donja=a;
        g[i].gornja=b;
    }
    for(int i=1;i<=m;i++)
    {
        scanf("%d %d %d",&a,&b,&c);
        p[i].index_i=a;
        p[i].index_j=b;
        p[i].tezina=c;
    }
    int br;
    for(int i=1;i<=m;i++)
    {
        br=0;
        for(int j=p[i].index_i;j<=p[i].index_j;j++)
        {
            if(p[i].tezina>=g[j].donja && p[i].tezina<=g[j].gornja)
                br++;
        }
        printf("%d\n",br);
    }
    return 0;
}