#include <bits/stdc++.h>0

using namespace std;

#define forn(i, n) for (int i = 0; i < n; i++)
#define sqr(a) ((a) * (a))
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define sz(a) (a.size())
#define all(a) a.begin(), a.end()
#define NAME "mountain"
#define FREOPEN freopen(NAME".in", "r", stdin); freopen(NAME".out", "w", stdout);

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

const int INF = 2e9;
const ll INF64 = 9e18;
const int N = 100100;
const int M = 1010;

int n, q;
ll x[N], y[N];

int main()
{
    FREOPEN;
    cin >> n >> q;
    for (int i = 1; i <= n; i++)
    {
        ll d, k;
        scanf("%I64d %I64d", &d, &k);
        x[i] = x[i - 1] + d;
        y[i] = y[i - 1] + k * d;
    }
    forn(uu, q)
    {
        ll v, u;
        cin >>  v >> u;
        ll l = v, r = v;
        int q = INF;
        for (int i = 0; i <= n; i++)
            if (x[i] <= v)
        {
         q = i;
        }
        else
            break;

        for (int i = q; i >= 0; i--)
        {
            ll a, b, c;
            a = y[i] - u;
            b = v - x[i];
            c = v * -a + u * -b;
            //cout << a << ' ' << b << ' ' << c << endl;
            bool f = 1;
            for (int j = 0; j <= n; j++)
            {
                if (x[j] >= min(x[i], v) && x[j] <= max(x[i], v))
                {
                    ld yy = y[i];
                    if (b != 0)
                        yy = ld(a * x[j] + c) / ld(-b);
                    //cout << j << ' ' << yy << endl;
                    if (yy < (ld)y[j])
                        f = 0;

                }
            }
            if (f)
                l = min(l, x[i]);
            if (!f)
                break;
        }

        q = INF;
        for (int i = 0; i <= n; i++)
            if (x[i] >= v)
        {
         q = i;
         break;
        }

        for (int i = q; i <= n; i++)
        {
            ll a, b, c;
            a = y[i] - u;
            b = v - x[i];
            c = v * -a + u * -b;
            //cout << a << ' ' << b << ' ' << c << endl;
            bool f = 1;
            for (int j = 0; j <= n; j++)
            {
                if (x[j] >= min(x[i], v) && x[j] <= max(x[i], v))
                {
                    ld yy = y[i];
                    if (b != 0)
                        yy = ld(a * x[j] + c) / ld(-b);
                    //cout << j << ' ' << yy << endl;
                    if (yy < (ld)y[j])
                        f = 0;

                }
            }
            if (f)
                r = max(r, x[i]);
            if (!f)
                break;
        }



        cout << l << ' ' << r << endl;
    }

    return 0;
}


/*

6 1
3 1
2 -1
1 1
1 -1
1 1
2 -1
5 3


6 4
1 2
2 -2
1 1
1 -2
4 1
1 -1
1 4
3 4
10 4
7 4




*/
