#include <iostream>

using namespace std;

typedef struct vaga {
    int d;
    int u;
};

int main()
{   
    int n, m, x,l,r,br;
    vaga a[200000];
    cin >> n >> m;
    
    for (int i = 0; i < n; i++)
    {
        cin >> a[i].d >> a[i].u;
    }
    for (int i = 0; i < m; i++)
    {
        br = 0;
        cin >> l >> r >> x;
        while (l <= r) {
            if (a[l - 1].d <= x)
                if (a[l-1].u >= x)
                    br++;
            l++;
        }
        cout << br << endl;
    }


    return 0;
}