#include <bits/stdc++.h>
using namespace std;
long long n,m,donja[10000],gornja[10000],a,b,granica,br;
int main(){
    cin >> n >> m;
    for (int i=1;i<=n;i++){
        cin >> donja[i] >> gornja[i];
    }
    for (int i=1;i<=m;i++){
        cin >> a >> b >> granica;
        br=0;
        for (int i=a;i<=b;i++){
            if (granica>=donja[i] and granica <=gornja[i])br++;
        }
        cout << br << endl;
    }

   return 0;
}