#include <bits/stdc++.h>
using namespace std;

int main(){
      int n, m;
      scanf("%d %d", &n, &m);

      pair<int, int> v[n+1];
      tuple<int, int, int> p[m];

      
      for(int i = 1;i <= n;i++){
            scanf("%d %d", &v[i].first, &v[i].second);
      } 
      // smallest weight, highest weight

      for (int i = 0;i < m;i++){
            scanf("%d %d %d", &get<0>(p[i]), &get<1>(p[i]), &get<2>(p[i]));
      }
      // first index, last index, wanted weight

      int x, y, z, br;
      for(int i = 0;i < m;i++){
            x = get<0>(p[i]);
            y = get<1>(p[i]);
            z = get<2>(p[i]);
            br = 0;

            for(int j = x;j <= y;j++){
                  if((z >= v[j].first) && (z <= v[j].second))
                        br++;
            }
            printf("%d\n", br);
      }
      
      return 0;
}