#include <bits/stdc++.h>

using namespace std;

long long br, n, m, d[100000000], u[100000000], l, r, x;

int main () {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> d[i] >> u[i];
    while(m--) {
         br = 0;
         cin >> l >> r >> x;
         for (int i = l; i <= r; i++) {
              if (d[i] <= x && u[i] >= x) br++;
         }
         cout << br << endl;
    }

return 0;
}