#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define sp ' '
#define en '\n'
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
using namespace std;
const int N = 2e5 + 2;
const int inf = 2e9;
struct Fenwick {
    int bit[N];
    void Reset(int n) {
        for (int i = 1; i <= n; i++) bit[i] = 0;
    }
    void Add(int x) {
         x += 1;
         for (; x < N; x += x & (-x)) bit[x]++;
    }
    int Get(int x) {
        x += 1;
        int ans = 0;
        for (; x > 0; x -= x & (-x)) ans += bit[x];
        return ans;
    }
}f;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, q;
    cin >> n >> q;
    vector<int> x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }
    vector<int> ans(q);
    vector<array<int, 3>> qq(q);
    for (int i = 0; i < q; i++) {
        cin >> qq[i][0] >> qq[i][1] >> qq[i][2];
        qq[i][0] -= 1; qq[i][1] -= 1;
        ans[i] = qq[i][1] - qq[i][0] + 1;
    }
    vector<array<int, 3>> all;
    for (int i = 0; i < n; i++) all.push_back({y[i], 1, i});
    for (int i = 0; i < q; i++) all.push_back({qq[i][2], 0, i});
    sort(all.begin(), all.end());
    f.Reset(n);
    for (auto u : all) {
        if (u[1] == 1) f.Add(u[2]);
        else ans[u[2]] -= f.Get(qq[u[2]][1]) - f.Get(qq[u[2]][0] - 1);
    }
    all.clear();
    for (int i = 0; i < n; i++) all.push_back({x[i], 1, i});
    for (int i = 0; i < q; i++) all.push_back({qq[i][2], 0, i});
    sort(all.begin(), all.end(), [&] (array<int, 3> xx, array<int, 3> yy) {
        if (xx[0] != yy[0]) return xx[0] > yy[0];
        return xx[1] < yy[1];
    });
    f.Reset(n);
    for (auto u : all) {
        if (u[1] == 1) f.Add(u[2]);
        else ans[u[2]] -= f.Get(qq[u[2]][1]) - f.Get(qq[u[2]][0] - 1);
    }
    for (int i = 0; i < q; i++) cout << ans[i] << en;
    return 0;
}