#include <bits/stdc++.h>
//trebam jos samo napraviti kad je neki broj prvi
using namespace std;

#define ll long long
#define ld long double
#define vt vector
#define pb push_back
#define all(a) a.begin(),a.end()
#define sz(x) (int)x.size()

const int MOD=1000000007;
const int mxN=2e5+5;

int a[mxN];

void solve(){
    int n,m;
    cin >> n >> m;
    vt<pair<ll,ll>> a(n);
    ll ivv=0,cade=0;
    for(int i=0; i<n; ++i){
        cin >> ivv >> cade;
        a[i]={ivv,cade};
    }
    ll l,r,x;
    while(m--){
        ll ans=0;
        cin >> l >> r >> x;
        l--;
        r--;
        for(int i=l; i<=r; ++i){
            if(x>=a[i].first&&x<=a[i].second){
                ans++;
            }
        }
        cout << 1LL*ans << "\n";
    }
}

int main(){
    ios::sync_with_stdio(0);
	cin.tie(0);

	int t=1;
	//cin >> t;
	while(t--){
        solve();
	}
}