#include <iostream>

int main()
{
    int n, m;
    std::cin >> n >> m;
    int prva[n + 1], druga[n + 1];
    prva[0] = 0;
    druga[0] = 0;
    for(int i = 1; i < n+1; i++){

        std::cin >> prva[i] >> druga[i];

    }
    int a[m], b[m], x[m];
    for(int i = 0; i < m; i++){

        std::cin >> a[i] >> b[i] >> x[i];

    }
    int brojac = 0;
    for(int i = 0; i < m; i++){

        for(int y = a[i]; y <= b[i]; y++){
            //std::cout << b[i] << "\n";
            if(x[i] >= prva[y] and x[i] <= druga[y]){

                brojac++;
                //std::cout << x[i] << " " << y << " " << prva[y] << " " << druga[y] <<"\n";

            }

        }
        std::cout << brojac << "\n";
        brojac = 0;
    }
    return 0;
}