// vage.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;
int main()
{
    int bv;
    int bp;
    cin >> bv;
    cin >> bp;
    int** vage = new int* [bv];
    for (int i = 0; i < bv; i++)
        vage[i] = new int[2];



    int** pitanja = new int* [bp];
    for (int i = 0; i < bp; i++)
        pitanja[i] = new int[3];
    for (int i = 0; i < bv; i++)
    {
        int l;
        int h;
        cin >> l;
        cin >> h;
        vage[i][0] = l;
        vage[i][1] = h;
    }
 
    for (int i = 0; i < bp; i++)
    {
        int l;
        int h;
        int x;
        cin >> l;
        cin >> h;
        cin >> x;
        
        pitanja[i][0] = l;
        pitanja[i][1] = h;
        pitanja[i][2] = x;
    }
    int en = 0;
    for (int i = 0; i < bp; i++)
    {
        for (int j = (pitanja[i][0] - 1); j <= ( pitanja[i][1]-1 ); j++)
        {
            if ((vage[j][0] <= pitanja[i][2])&& (vage[j][1] >= pitanja[i][2]))
            {
                //cout << vage[j][0] << " " << pitanja[j][2] << " " <<  pitanja[j][2]<<endl;
                en += 1;
            }
        }

        cout << en << endl;;
       // cout << endl;
        en = 0;
    }
}