#include <bits/stdc++.h>

using namespace std;

int main() {
    long long n, m; //n vaga m pitanja
    cin >> n >> m;
    long long tezine[n][2], resenja[m], resenjaBr = 0;

    for (int i = 0; i < n; i++) {
        long long d, u;
        cin >> d >> u;
        tezine[i][0] = d;
        tezine[i][1] = u;
    }

    for (int i = 0; i < m; i++) {
        long long l, r, x;
        cin >> l >> r >> x;
        l = l - 1;
        r = r - 1;
        long long resenje = 0;
        for (int j = l; j <= r; j++) {
            if (x >= tezine[j][0] && x <= tezine[j][1]) resenje++;
        }
        resenja[resenjaBr] = resenje;
        resenjaBr++;
    }

    for (int i = 0; i < resenjaBr; i++) {
        cout << resenja[i] << endl;
    }
}