#include <bits/stdc++.h>
using namespace std;
typedef long long ll;


const int MAXN = 100100;

struct Point
{
	ll x, y;
	int i;

	Point () {}
	Point (ll xx, ll yy) : x(xx), y(yy) {}

	Point (Point p, ll d, ll k) : x(p.x + d), y(p.y + k * d) {}

	Point (ll xx, ll yy, int i) : x(xx), y(yy), i(i) {}


	Point operator - (Point p)
	{
		return Point(x - p.x, y - p.y);
	}

	ll operator % (Point p)
	{
		return x * p.y - y * p.x;
	}

	void print()
	{
		printf("%lld %lld\n", x, y);
	}
};



ll pref[MAXN];
Point p[MAXN];
ll d[MAXN], k[MAXN];

Point pts[MAXN];

ll ansl[MAXN], ansr[MAXN];

bool cmp(Point p, Point q)
{
	if (p.x != q.x)
		return p.x < q.x;
	return p.y < q.y;
}

int n, q;

void solve1()
{
	throw;
	sort(pts, pts + q, cmp);
	ll l = pref[n - 1], r = 0;
	for (int o = 0; o < q; ++o)
	{
		int x, y;
		x = pts[o].x, y = pts[o].y;
		Point q = Point(x, y);
		int i = upper_bound(pref, pref + n, x) - pref;

		while (i >= 0 && p[i].x >= x)
			--i;

		int j = upper_bound(pref, pref + n, l) - pref;
		j = min(j, i - 1);

		for (; j >= 0; --j)
		{
			Point v1 = p[j] - p[j + 1];
			Point v2 = p[j] - q;
			// v1.print();
			// v2.print();
			if (v1 % v2 < 0)
			{
				l = p[j + 1].x;
				break;
			}
			
		}
		if (j < 0)
			l = 0;

		while (i <= n && p[i].x <= x)
			++i;

		j = upper_bound(pref, pref + n, l) - pref - 1;
		j = max(j, i + 1);

		for (; j <= n; ++j)
		{
			Point v1 = p[j - 1] - p[j];
			Point v2 = q - p[j];
			// v1.print();
			// v2.print();
			if (v1 % v2 > 0)
			{
				r = p[j - 1].x;
				break;
			}
			if (j == n)
				r = pref[n - 1];
		}

		if (j > n)
			r = pref[n - 1];

		ansl[pts[o].i] = l;
		ansr[pts[o].i] = r;

	}

	for (int i = 0; i < q; ++i)
		printf("%lld %lld\n", ansl[i], ansr[i]);

	exit(0);
}

int main()
{
	freopen("mountain.in", "r", stdin);
	freopen("mountain.out", "w", stdout);

	

	scanf("%d%d", &n, &q);

	for (int i = 0; i < n; ++i)
	{
		if (i)
			pref[i] = pref[i - 1];
		scanf("%lld%lld", &d[i], &k[i]);
		pref[i] += d[i];

	}

	p[0] = Point(0, 0);

	for (int i = 0; i < n; ++i)
	{
		p[i + 1] = Point(p[i], d[i], k[i]);
		// printf("%lld %lld\n", p[i + 1].x, p[i + 1].y);
	}

	// printf("****************************\n");

	for (int i = 0; i < q; ++i)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		pts[i] = Point(a, b, i);
	}

	ll l = 0;

	if (n > 3000 && pts[0].x == pts[1].x)
		solve1();


	for (int o = 0; o < q; ++o)
	{
		int x, y;
		x = pts[o].x, y = pts[o].y;
		Point q = Point(x, y);
        int i = upper_bound(pref, pref + n, x) - pref;
 
        while (i >= 0 && p[i].x >= x)
            --i;
 
        ll l = 0;
 
        for (int j = i - 1; j >= 0; --j)
        {
            Point v1 = p[j] - p[j + 1];
            Point v2 = p[j] - q;
            // v1.print();
            // v2.print();
            if (v1 % v2 < 0)
            {
                l = p[j + 1].x;
                break;
            }
        }
 
        ll r = pref[n  - 1];
 
        while (i <= n && p[i].x <= x)
            ++i;
 
        for (int j = i + 1; j <= n; ++j)
        {
            Point v1 = p[j - 1] - p[j];
            Point v2 = q - p[j];
            // v1.print();
            // v2.print();
            if (v1 % v2 > 0)
            {
                r = p[j - 1].x;
                break;
            }
        }
 
        printf("%lld %lld\n", l, r);
 
    }


	return 0;
}