#include <bits/stdc++.h>

int main()
{
    int n,m;
    std::cin>>n>>m;

    std::vector<std::vector<int>> w;
    std::vector<std::vector<int>> q;

    for (size_t i = 0; i < n; i++)
    {
        std::vector<int> tmp;
        int a,b;
        std::cin>>a>>b;
        tmp.push_back(a);
        tmp.push_back(b);
        w.push_back(tmp);            
    }
    for (size_t i = 0; i < m; i++)
    {
        std::vector<int> tmp;
        int a,b,c;
        std::cin>>a>>b>>c;
        tmp.push_back(a);
        tmp.push_back(b);
        tmp.push_back(c);
        q.push_back(tmp); 
    }

    int itr;

    for(auto inst : q)
    {
        itr = 0;
        for (size_t i = inst[0]-1; i < inst[1] ; i++)
        {
            if(inst[2]>=w[i][0] && inst[2]<=w[i][1]) itr++;
        }
        std::cout<<itr<<"\n";
        
    }   

    return 0;
}