#include <iostream>
#include <iomanip>
#include <cstdio>

#include <cassert>
#include <cmath>
#include <algorithm>
#include <ctime>

#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <utility>

using std::cin;
using std::cout;
using std::cerr;

using std::max;
using std::min;
using std::abs;

using std::vector;
using std::pair;
using std::string;
using std::queue;
using std::set;
using std::map;
#define ll int
// typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pul;

#define ff first 
#define ss second 
#define pb push_back 
#define print(a) cerr << (a) << '\n' 
#define dbg(a) cerr << #a << " = " << (a) << '\n' 
#define dbg2(a, b) cerr << #a << " = " << (a) << ' ' << #b << " = " << (b) << '\n' 
#define dbg3(a, b, c) cerr << #a << " = " << (a) << ' ' << #b << " = " << (b) << ' ' << #c << " = " << (c) << '\n' 

void init() {
	#ifndef LOCAL
	freopen("mountain.in", "r", stdin);
	freopen("mountain.out", "w", stdout);
	#endif
	std::iostream::sync_with_stdio(0);
	cout << std::fixed << std::setprecision(10);
	cerr << std::fixed << std::setprecision(10);
}

const int MAXC = 10001;

ll y[MAXC];
ll k[MAXC];
int main() {
	init();
	
	y[0] = 0;
	int n, q;
	cin >> n >> q;

	for (int i = 0; i < MAXC; ++i)
		k[i] = -12354;

	int last = 0;
	for (int i = 1; i <= n; ++i) {
		int x; ll d;
		cin >> x >> d;
		int nw = x + last;
		for (int j = nw; j > last; --j)
			k[j] = d;
		last += x;
	}

	for (int i = MAXC - 2; i > 0; --i)
		if (k[i] == -12354)
			k[i] = k[i + 1];

	for (int i = 1; i < MAXC; ++i)
		y[i] = y[i - 1] + k[i];

	for (int t = 0; t < q; ++t) {
		double nx; double ny;
		cin >> nx >> ny;
		int l, r; 
		{
			double mxtg = -999999;
			for (l = nx - 1; l >= 0; --l) {
				double curx = l, cury = y[l];
				double curtg = (ny - cury) / (curx - nx);
				if (curtg < mxtg) {
					++l;
					break;
				}
				mxtg = max(mxtg, curtg);
			}
		}
		double mxtg = -999999;
		for (r = nx + 1; r <= last; ++r) {
			double curx = r, cury = y[r];
			double curtg = (ny - cury) / (nx - curx);
			if (curtg < mxtg) {
				--r;
				break;
			}
			mxtg = max(mxtg, curtg);
		}
		cout << max(l, 0) << ' ' << min(r, last) << '\n';
	}

	return 0;
}