#include <iostream>

using namespace std;

struct vaga {
    int d;
    int g;
};
struct pitanje {
    int l;
    int r;
    int x;
};
int main()
{
    int n, m;
    int br = 0;
    cin >> n >> m;
    vaga v[99999];
    pitanje p[99999];
    for (int i = 1; i <= n; i++) {
        cin >> v[i].d;
        cin >> v[i].g;
    }
    for (int i = 1; i <= m; i++) {
        cin >> p[i].l;
        cin >> p[i].r;
        cin >> p[i].x;
    }
    for (int i = 1; i <= m; i++) {
        for (int j = p[i].l; j <= p[i].r; j++) {
            if (p[i].x >= v[j].d && p[i].x <= v[j].g) {
                br++;
            }
        }
        cout << br << endl;
        br = 0;
    }
}