#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int N, Q, L, R, X, Y, ima = 0;
    cin >> N >> Q;
    vector <pair<int, int> > A(N);
    for(int i = 0; i < N; i++) {cin >> X >> Y; A[i] = {X, Y};}
    while(Q--)
    {
        ima = 0;
        cin >> L >> R >> X;
        L--;
        R--;
        for(int i = L; i <= R; i++) {if(X >= A[i].first && X <= A[i].second) ima++;}
        cout << ima << endl;
    }
    return 0;
}