#include <iostream>

using namespace std;

struct vaga { int min, max; };

struct pitanje { int l, r, x; };

int count(vaga vage[], int n, pitanje p) {
    int counter = 0;
    for (int j = p.l - 1; j < p.r; j++) if (vage[j].min <= p.x && vage[j].max >= p.x) counter++;
    return counter;
}

int main()
{
    int n, m;
    cin >> n >> m;
    vaga vage[n];
    pitanje pitanja[m];
    
    for (int i = 0; i < n; i++) cin >> vage[i].min >> vage[i].max;
    for (int i = 0; i < m; i++) cin >> pitanja[i].l >> pitanja[i].r >> pitanja[i].x;
    
    for (int i = 0; i < m; i++) cout << count(vage, n, pitanja[i]) << endl;

    return 0;
}