#include <vector>
#include <iostream>
#include <algorithm>

void CasesA(int n, int m, std::vector<std::pair<int, int>>& weights) {
    std::vector<int> _l;
    std::vector<int> _r;
    std::vector<int> _x;
    int M = m;
    while (M--) {
        int l;
        int r;
        int x;
        std::cin >> l >> r >> x;
        --l;
        --r;
        _l.push_back(l);
        _r.push_back(r);
        _x.push_back(x);
    }
    for (int k = 0; k < m; ++k) {
        int count = 0;
        for (int i = _l[k]; i <= _r[k]; ++i) {
            count += weights[i].first <= _x[k] && _x[k] <= weights[i].second;
        }
        std::cout << count << std::endl;
    }
}
void OptimiseIO() {
    std::ios_base::sync_with_stdio(false);
    std::cout.tie(0);
    std::cerr.tie(0);
    std::cin.tie(0);
}

int main() {
    OptimiseIO();
    int n;
    int m;
    std::cin >> n >> m;
    std::vector<std::pair<int, int>> weights(n);
    for (int i = 0; i < n; ++i) {
        // weights[i].first = i;
        // weights[i].second = 2 * n - i;
        std::cin >> weights[i].first >> weights[i].second;
    }
    CasesA(n, m, weights);
    return 0;
}