#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0)

#define xx first
#define yy second

using namespace std;


using namespace __gnu_pbds;
int main()
{

    FAST;

    int n, m; cin >> n >> m;
    pair<int, int> d[n];
    for(int i = 0; i < n; i++) cin >> d[i].xx >> d[i].yy;
    pair<int, int> edge[m];
    int weight[m];
    for(int i = 0; i < m; i++) cin >> edge[i].xx >> edge[i].yy >> weight[i];


    for(int i = 0; i < m; i++){
        int solution = 0;
        for(int j = edge[i].xx - 1; j <= edge[i].yy - 1; j++){
            if(weight[i] >= d[j].xx && weight[i] <= d[j].yy) solution++;
        }


        cout << solution << endl;
    }

    return 0;
}