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

using namespace std;

#define SIZE 100228
#define inf 1000000007
#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 begs[SIZE];
ll sv_x = inf;
ll sv_y = inf;
ll lans[SIZE], rans[SIZE];

bool ys(Point a, Point b)
{
	return a.y < b.y;
}

bool sx(Point a, Point b)
{
	return a.x < b.x;
}


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;
		ask[i].num = i;
		if (sv_x == inf)
			sv_x = ask[i].x;
		else if (sv_x == -inf || sv_x == ask[i].x)
			continue;
		else
			sv_x = -inf;
		if (sv_y == inf)
			sv_y = ask[i].y;
		else if (sv_y == -inf || sv_y == ask[i].y)
			continue;
		else
			sv_y = -inf;
	}
	if (sv_x == -inf && sv_y == -inf)
	{
		for (int i = 0; i < q; i++)
		{
			int lbeg, rbeg;
			int pos = lower_bound(begs, begs + n + 1, ask[i].x) - begs;
			if (begs[pos] == ask[i].x)
			{
				lbeg = pos;
				rbeg = pos;
			}
			else
			{
				lbeg = pos - 1;
				rbeg = pos;
			}
			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 if (sv_x != -inf)
	{
		sort(ask, ask + q, ys);
		int lbeg, rbeg;
		int pos = lower_bound(begs, begs + n + 1, ask[0].x) - begs;
		if (begs[pos] == ask[0].x)
		{
			lbeg = pos;
			rbeg = pos;
		}
		else
		{
			lbeg = pos - 1;
			rbeg = pos;
		}
		while (lbeg > 0)
		{
			if (begs[pos] == ask[0].x && lbeg == pos)
			{
				lbeg--;
				continue;
			}
			if (CrossProd(l[lbeg - 1] - ask[0], l[lbeg] - ask[0]) < 0)
				break;
			lbeg--;
		}
		while (rbeg < n)
		{
			if (begs[pos] == ask[0].x && rbeg == pos)
			{
				rbeg++;
				continue;
			}
			if (CrossProd(l[rbeg + 1] - ask[0], l[rbeg] - ask[0]) > 0)
				break;
			rbeg++;
		}
		lans[ask[0].num] = l[lbeg].x;
		rans[ask[0].num] = l[rbeg].x;
		for (int i = 1; i < q; i++)
		{
			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++;
			}
			lans[ask[i].num] = l[lbeg].x;
			rans[ask[i].num] = l[rbeg].x;
		}
		for (int i = 0; i < q; i++)
			cout << lans[i] << ' ' << rans[i] << endl;
	}
	else
	{
		sort(ask, ask + q, sx);
		int lbeg, rbeg;
		int pos = lower_bound(begs, begs + n + 1, ask[0].x) - begs;
		if (begs[pos] == ask[0].x)
		{
			lbeg = pos;
			rbeg = pos;
		}
		else
		{
			lbeg = pos - 1;
			rbeg = pos;
		}
		while (rbeg < n)
		{
			if (begs[pos] == ask[0].x && rbeg == pos)
			{
				rbeg++;
				continue;
			}
			if (CrossProd(l[rbeg + 1] - ask[0], l[rbeg] - ask[0]) > 0)
				break;
			rbeg++;
		}
		rans[ask[0].num] = l[rbeg].x;
		for (int i = 1; i < q; i++)
		{
			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++;
			}
			rans[ask[i].num] = l[rbeg].x;
		}
		pos = lower_bound(begs, begs + n + 1, ask[q - 1].x) - begs;
		if (begs[pos] == ask[q - 1].x)
			lbeg = pos;
		else
			lbeg = pos - 1;
		while (lbeg > 0)
		{
			if (begs[pos] == ask[q - 1].x && lbeg == pos)
			{
				lbeg--;
				continue;
			}
			if (CrossProd(l[lbeg - 1] - ask[q - 1], l[lbeg] - ask[q - 1]) < 0)
				break;
			lbeg--;
		}
		lans[ask[q - 1].num] = l[lbeg].x;
		for (int i = q - 2; i > -1; i--)
		{
			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--;
			}
			lans[ask[i].num] = l[lbeg].x;
		}
		
		for (int i = 0; i < q; i++)
			cout << lans[i] << ' ' << rans[i] << endl;
	}
	return 0;
}