#include <iostream>
#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> par;

int main()
{
    int n, m, i, j, d, u, l, r, x;
    cin >> n >> m;
    vector<par> vage;
    vage.push_back(make_pair(-1, -1));
    for(i=1; i<=n; i++)
    {
        cin >> d >> u;
        vage.push_back(make_pair(d, u));
    }
    //for(i=1; i<=n; i++){cout << i << " " << vage[i].first << " " << vage[i].second << endl;}cout << endl;
    for(j=0; j<m; j++)
    {
        cin >> l >> r >> x;
        int res=0;

        for(i=l; i<=r; i++)
        {
            if(vage[i].first<=x && x<=vage[i].second)
            {
                res++;
            }a
        }
        cout << res << endl;
    }
}