#include <bits/stdc++.h>

using namespace std;
typedef long long ll;


ll vect(ll x1, ll y1, ll x2, ll y2) {
    return x1 * y2 - y1 * x2;
}

ll x[3050], y[3050];

int main()
{
    freopen("mountain.in", "r", stdin);
    freopen("mountain.out", "w", stdout);
    ios::sync_with_stdio(0);
    int n, q;
    cin >> n >> q;
    for (int i = 1; i <= n; i++) {
        int d, k;
        cin >> d >> k;
        x[i] = x[i - 1] + d;
        y[i] = y[i - 1] + k * d;
    }
    for (int i = 0; i < q; i++) {
        int cx, cy, l = 0, r = x[n];
        cin >> cx >> cy;
        int st = lower_bound(x, x + n + 1, cx) - x - 1, en;
        if (cx == x[st + 1])
            en = st + 2;
        else
            en = st + 1;
        cout << st << endl;
        for (int i = st; i > 0; i--) {
            if (x[i] >= cx)
                break;
            if (vect(x[i] - x[i - 1], y[i] - y[i - 1], cx - x[i], cy - y[i]) < 0) {
                l = x[i];
                break;
            }
        }
        for (int i = en; i < n; i++) {
            if (x[i] <= cx)
                break;
            if (vect(x[i] - x[i + 1], y[i] - y[i + 1], cx - x[i], cy - y[i]) > 0) {
                r = x[i];
                break;
            }
        }
        cout << l << " " << r << endl;
    }
    return 0;
}
