#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define cy cout << "YES"<< endl;
#define cn cout << "NO"<< endl;
#define pf push_front
#define pb push_back
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vll vector<ll>


void solve()
{
    int n,m;cin >> n >> m;
    vector <pair<int,int>> v(n);
    for(int i=0; i<n; i++)
    {
        cin >> v[i].first >> v[i].second;
    }
    for(int i = 0; i < m; i++)
    {
        int ans=0;
        int l,r,x;cin >> l >> r >> x;
        for(int i = l-1; i < r; i++)
        {
            if(v[i].first <= x && v[i].second >= x)
            ans++;
        }
        cout << ans << endl;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(nullptr);
 
    solve();
}