#include <iostream>

using namespace std;

struct vaga
{
    int donjaGranica;
    int gornjaGranica;
};

int main()
{
    int n, m;
    cin >> n >> m;
    vaga vage[n];
    for(int i = 0; i < n; i++)
    {
        cin >> vage[i].donjaGranica >> vage[i].gornjaGranica;
    }

    for(int i = 0; i < m; i++)
    {
        int l, r, x;
        cin >> l >> r >> x;
        int br = 0;
        for(int j = l-1; j < r; j++)
        {
            if(vage[j].donjaGranica <= x && vage[j].gornjaGranica >= x)
            {
                br++;
            }
        }
        cout << br << endl;
    }

    return 0;
}