#include <iostream>
#include <stdlib.h>
#include <algorithm>
using namespace std;

#pragma warning(disable : 4996)

int main()
{
    int n, m;
    scanf("%d %d", &n, &m);
    int* g = new int[n+1];
    int* d = new int[n+1];
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &d[i]);
        scanf("%d", &g[i]);
    }
    int* l = new int[m+1];
    int* r = new int[m+1];
    int* x = new int[m+1];
    for (int i = 1; i <= m; i++)
    {
        scanf("%d", &l[i]);
        scanf("%d", &r[i]);
        scanf("%d", &x[i]);
    }
    int k = 0;
    for (int i = 1; i <= m; i++)
    {
        k = 0;
        for (int j = l[i]; j <= r[i]; j++)
        {
            if ((d[j] <= x[i]) && (g[j] >= x[i]))
            {
                k++;
            }
        }
        cout << k << '\n';
    }
}