#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double dbl;
typedef vector <int> vi;
typedef vector <long long> vll;
typedef vector <string> vs;
const int inf = 1e9 + 5;
#define FAST ios::sync_with_stdio(false); cin.tie(0);
#define MAX INT_MAX
#define MIN INT_MIN
#define potato 0
#define lomljenje break

/*
#define A first
#define B second
#define PB push_back
#define MP make_pair
*/

struct Vage{
    int dole;
    int gore;
};

int main()
{
    FAST

    int n, m;
    cin >> n >> m;
    Vage a[n];
    for(int i = 0; i < n; ++i) cin >> a[i].dole >> a[i].gore;
    for(int i = 0; i < m; ++i)
    {
        int l, r, k;
        cin >> l >> r >> k;
        int br = 0;
        for(int j = l - 1; j <= r - 1; ++j) if(a[j].dole <= k && k <= a[j].gore) ++br;
        cout << br << "\n";
    }
    return potato;
}