#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;

    vector<pair<int,int>> vage(n);
    for(int i = 0; i < n; i++)
    {
        cin >> vage[i].first >> vage[i].second;
    }

    int answer[m];
    for(int j = 0; j < m; j++)
    {
        int l, r, x;
        cin >> l >> r >> x;

        int c = 0;
        for(int i = l - 1; i <= r - 1; i++)
        {
            if(vage[i].first <= x && vage[i].second >= x)
                c++;
        }
        answer[j] = c;
    }

    for(int i = 0; i < m; i++)
    {
        cout << answer[i] << "\n";
    }
    return 0;
}