#include <bits/stdc++.h>

using namespace std;

int minMasa[200008];
int maxMasa[200008];
int l[200008];
int r[200008];
int tezina[200008];
int rez[200008];

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n, m; cin >> n >> m;

    for(int i = 0; i < n; i++)
    {
        cin >> minMasa[i] >> maxMasa[i];
    }

    for(int i = 0; i < m; i++)
    {
        cin >> l[i] >> r[i] >> tezina[i];

        for(int j = l[i]; j <= r[i]; j++)
        {
            if(tezina[i] >= minMasa[j - 1] && tezina[i] <= maxMasa[j - 1])
            {
                rez[i]++;
                //cerr << minMasa[j - 1] << " <= " << tezina[i] << " <= " << maxMasa[j - 1] << endl;
            }
            else
            {
                //cerr << "NIJE: " << minMasa[j - 1] << " <= " << tezina[i] << " <= " << maxMasa[j - 1] << endl;
            }
        }
    }

    for(int i = 0; i < m; i++)
    {
        cout << rez[i] << endl;
    }



    return 0;
}