#include <iostream>
using namespace std;

int main() {
  long long n, m, i = 0, d, u, l, r, x, h = 0;
  cin >> n >> m;
  long long a[2][n], b[m];
  for (int i = 1; i <= n; i++) {
    cin >> a[0][i] >> a[1][i];
  }
  for (int j = 0; j < m; j++) {
    b[h] = 0;
    cin >> l >> r >> x;
    for (int k = l; k <= r; k++) {
      if (a[0][k] <= x && a[1][k] >= x) {
        b[h]++;
      }
    }
    h++;
  }
  for (int j = 0; j < m; j++) {
    cout << b[j] << endl;
  }
}