#include <bits/stdc++.h>

using namespace std;

int n,m;
pair<int,int> Vaga[1000000];

class Pitanja
{
public:
    int pocetal;
    int kraj;
    int x;
};

Pitanja Pitanja[1000000];

int main()
{

    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        cin>>Vaga[i].first;
        cin>>Vaga[i].second;
    }
    pair<int,int> temp;
    for(int i=1;i<=m;i++)
    {
        cin>>Pitanja[i].pocetal;
        cin>>Pitanja[i].kraj;
        cin>>Pitanja[i].x;
    }



    int rez;
    for(int i=1;i<=m;i++)
    {
        rez = 0;
        for(int j = Pitanja[i].pocetal;j <= Pitanja[i].kraj;j++)
        {
            if(Pitanja[i].x >= Vaga[j].first and Pitanja[i].x <= Vaga[j].second)
            {
                rez++;
            }
        }
        cout<<rez<<endl;
    }


    return 0;
}