#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>

using namespace std;

#define SIZE 100228
#define ll long long

struct Point
{
	ll x, y;
	int num;
	Point() {}
	Point(ll x, ll y) :x(x), y(y) {}
};

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

ll CrossProd(Point a, Point b)
{
	return a.x * b.y - a.y * b.x;
}

int n, q;
Point p[SIZE], ask[SIZE];
Point l[SIZE];
ll svx = 1000000007;
ll begs[SIZE];

int main()
{
	freopen("mountain.in", "r", stdin);
	freopen("mountain.out", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> q;
	for (int i = 0; i < n; i++)
		cin >> p[i].x >> p[i].y;
	begs[0] = 0;
	l[0].x = 0;
	l[0].y = 0;
	for (int i = 1; i <= n; i++)
	{
		begs[i] = begs[i - 1] + p[i - 1].x;
		l[i].x = begs[i];
		l[i].y = l[i - 1].y + p[i - 1].y * p[i - 1].x;
	}
	for (int i = 0; i < q; i++)
	{
		cin >> ask[i].x >> ask[i].y;
		if (svx == 1000000007)
			svx = ask[i].x;
		else if (svx == -1000000007)
			continue;
		else if (svx == ask[i].x)
			continue;
		else
			svx = -1000000007;
	}
	//if (svx == -1000000007)
	//{
		for (int i = 0; i < q; i++)
		{
			int lbeg, rbeg;
			int pos = lower_bound(begs, begs + n, ask[i].x) - begs;
			if (begs[pos] == ask[i].x)
			{
				lbeg = pos;
				rbeg = pos;
			}
			else
			{
				lbeg = pos;
				rbeg = pos + 1;
			}
			while (lbeg > 0)
			{
				if (begs[pos] == ask[i].x && lbeg == pos)
				{
					lbeg--;
					continue;
				}
				if (CrossProd(l[lbeg - 1] - ask[i], l[lbeg] - ask[i]) < 0)
					break;
				lbeg--;
			}
			while (rbeg < n)
			{
				if (begs[pos] == ask[i].x && rbeg == pos)
				{
					rbeg++;
					continue;
				}
				if (CrossProd(l[rbeg + 1] - ask[i], l[rbeg] - ask[i]) > 0)
					break;
				rbeg++;
			}
			cout << l[lbeg].x << ' ' << l[rbeg].x << endl;
		}
	/*}
	else
	{

	}*/
	return 0;
}