#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int C = 1e4;
int n, q;
vector<int> x, y;

int main(){

    ios::sync_with_stdio(false);
    freopen("mountain.in", "r", stdin);
    freopen("mountain.out", "w", stdout);

    cin >> n >> q;

    x.resize(n+1), y.resize(n+1);
    x[0] = y[0] = 0;

    vector<int> get_y(C+1);
    get_y[0] = 0;

    for(int i = 1; i <= n; i++){
        int d, k;
        cin >> d >> k;
        x[i] = x[i-1]+d;
        y[i] = y[i-1]+d*k;
        //cerr << "# " << x[i] << " " << y[i] << endl;;
        for(int _x = max(1, x[i-1]+1); _x <= x[i]; _x++)
            get_y[_x] = get_y[_x-1] + k;//, cerr << _x << " " << get_y[_x] << endl;
    }

    for(int i = 0; i < q; i++){
        int _x, _y;
        cin >> _x >> _y;
        double max_slope = -1e9;
        bool fail = false;
        for(int i = _x-1; i >= 0; i--){
            double slope = (double) (get_y[i]-_y) / (double) (_x-i);
            //cerr << i << " " << slope << endl;
            if(slope < max_slope){
                cout << i+1 << " ";
                fail = true;
                break;
            }
            max_slope = max(max_slope, slope);
        }
        if(!fail)
            cout << 0 << " ";

        max_slope = -1e9;
        fail = false;
        for(int i = _x+1; i <= x[n]; i++){
            double slope = (double) (get_y[i]-_y) / (double) (i-_x);
            if(slope < max_slope){
                cout << i-1 << endl;
                fail = true;
                break;
            }
            max_slope = max(max_slope, slope);
        }
        if(!fail)
            cout << x[n] << endl;
    }

    return 0;
}
