#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int N, M;
    cin >> N >> M;
    int d[N];
    int u[N];
    for (size_t i = 0; i < N; i++)
    {
        cin >> d[i] >> u[i];
    }int l, r, t, br = 0;
    for (size_t i = 0; i < M; i++)
    {
        cin >> l >> r >> t;
        for (size_t j = l-1; j < r; j++)
        {
            if (d[j] <= t && u[j] >= t||d[j]==u[j]&&u[j]==t)br++;
        }
        cout<< br<<"\n";
        br = 0;
    }
}