#include <iostream>
#include <vector>
#include <string>
#include<algorithm>
using namespace std;
typedef unsigned long long ull;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,i,d[200000], u[200000], m, l, r, x;
    int br = 0;
    cin >> n >> m;
    for (i = 0; i < n; i++)
    {
        cin >> d[i] >> u[i];
    }
    int j;
    for (i = 0; i < m; i++)
    {
        br = 0;
        cin >> l >> r>>x;
        for (j = l - 1; j < r; j++)
        {
            if (d[j] <= x && x <= u[j])
                br++;
        }
        cout << br << endl;
    }
}