#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n, m;
    pair<int, int> a[200000];
    cin >> n >> m;
    for (int i = 0; i < n; i++){
        cin >> a[i].first >> a[i].second;
    }
    int l, r, x; bool dal = false;
    int counter ;
    for (int i = 0; i < m; i++){
        cin >> l >> r >> x;
        l--;
        r--;
        counter = 0;
        for (int i = l; i <= r; i++){
            if (a[i].first <= x && a[i].second >= x){
                //cout << a[i].first << " " << a[i].second << " " << x << " ";
                counter++;
            }
        }
        cout << counter << "\n";

    }
}