#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    int m;
    int d;
    int u;
    int l;
    int r;
    int x;
    int br;
    vector<pair<int, int>> vage;
    vector<tuple<int, int, int>> odredi;
    cin >> n >> m;
    vage.resize(n);



    odredi.resize(m);
    for (int i = 0; i < n; i++)
    {
        cin >> d >> u;
        vage[i] = make_pair(d, u);
    }
    for (int i = 0; i < m; i++)
    {
        cin >> l >> r >> x;
        odredi[i] = make_tuple(l - 1, r - 1, x);
    }
    for (int i = 0; i < m; i++)
    {
        l = get < 0 > (odredi[i]);
        d = get < 1 > (odredi[i]);
        x = get < 2 > (odredi[i]);
        br = 0;
        for (int j = l; j <= d; j++)
        {
            if (vage[j].first <= x && vage[j].second >= x)
            {
                br++;
            }
        }
        cout << br << endl;
    }
    return 0;
}