#include <iostream>

int main() {
    unsigned int n, m;
    std::cin >> n >> m;
    unsigned int d[n], u[n];
    unsigned int l[m], r[m], x[m];
    for (unsigned int i = 0; i < n; i++) {
        std::cin >> d[i] >> u[i];
    }
    for (unsigned int i = 0; i < m; i++) {
        std::cin >> l[i] >> r[i] >> x[i];
    }
    for (unsigned int i = 0; i < m; i++) {
        unsigned int count = 0;
        for (unsigned int j = l[i] - 1; j <= r[i] - 1; j++) {
            if (x[i] >= d[j] && x[i] <= u[j]) {
                count++;
            }
        }
        std::cout << count << std::endl;
    }
    return 0;
}