#include <iostream>
using namespace std;

struct vaga {
    int d;
    int u;
};
struct pitanje {
    int l;
    int k;
    int x;
};



int main() {

    int n, m, g = 0;

    cin >> n >> m;

    vaga v[n];
    pitanje p[m];


    for (int i = 0; i < n; i++) {
        cin >> v[i].d >> v[i].u;
    }
    for (int i = 0; i < m; i++) {
        cin >> p[i].l >> p[i].k >> p[i].x;
    }

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

        for (int j = p[i].l; j <= p[i].k; j++) {

            if(p[i].x >= v[j-1].d && p[i].x <= v[j-1].u) {
                g++;
            }

        }
        cout << g << endl;
        g = 0;
    }



     return 0;
}