#include<bits/stdc++.h>

using namespace std;

int main()
{
    freopen("mountain.in", "r", stdin);
    freopen("mountain.out", "w", stdout);
    int n, q;
    cin >> n >> q;
    int d[n + 1];
    int k[n + 1];
    int x[n + 1];
    int y[n + 1];
    for (int i = 0; i < n; i++)
    {
        cin >> d[i] >> k[i];
    }
    x[0] = 0;
    y[0] = 0;
    for (int i = 1; i <= n; i++)
    {
        x[i] = x[i - 1] + d[i - 1];
        y[i] = y[i - 1] + k[i - 1] * d[i - 1];
    }
    k[n] = -1000000000;
    int rans, lans;
    lans = 0;
    for (int i = 0; i < q; i++)
    {
        int tmp1, tmp2;
        lans = 0;
        cin >> tmp1 >> tmp2;
        for (int i = 0; i <= n; i++)
        {
            if (x[i] > tmp1)
            {
                //cout << ((double)x[i] - tmp1) / ((double)y[i] - tmp2) << " ";
                if (k[i] < ((double)y[i] - tmp2) / ((double)x[i] - tmp1))
                {
                    rans = x[i];
                    break;
                }
            }
        }
        for (int i = n; i > 0; i--)
        {
            if (x[i] < tmp1)
            {
                //cout << k[i - 1] << " " << ((double)y[i] - tmp2) / ((double)x[i] - tmp1) << " ";
                if (k[i - 1] > ((double)y[i] - tmp2) / ((double)x[i] - tmp1))
                {
                    lans = x[i];
                    break;
                }
            }
        }
        cout << lans << " " << rans;
    }
}
