#include <iostream>
#include <cstdio>
#define MAXN 500000
#define ld long double
#define ll long long
using namespace std;

ll d[MAXN], k[MAXN], x[MAXN], b[MAXN], y[MAXN], n, q, u, v;
int main()
{
    freopen("mountian.in", "r", stdin);
    freopen("mountian.out", "w", stdout);
    cin >> n >> q;
    cin >> d[0] >> k[0];
    x[0] = d[0];
    b[0] = 0;
    y[0] = k[0] * x[0];
    for (int i = 1; i < n; i++)
    {
        cin >> d[i] >> k[i];
        x[i] = x[i - 1] + d[i];
        b[i] = y[i - 1] - x[i - 1] * k[i];
        y[i] = k[i] * x[i] + b[i];
    }
    for(int p = 0; p < q; p++)
    {
        cin >> u >> v;
        ll l = -1, r = -1, len = 0, i0 = n - 1;
        for (int i = 0; i < n; i++)
            if (u <= x[i] && u >= x[i] - d[i])
                i0 = i;
        for (int i = i0; i < n; i++)
            if (k[i] * u + b[i] <= v)
                r = x[i];
            else
                break;
        for (int i = i0; i >= 0; i--)
            if (k[i] * u + b[i] <= v)
                l = x[i] - d[i];
            else
                break;
        cout << l << ' ' << r << '\n';
        cerr << l << ' ' << r << '\n';
    }
    return 0;
}
