#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <set>
#include <cstdlib>
#include <vector>
#define ll long long
using namespace std;

const int MAXN = 1e5;

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

struct Vector
{
	int x, y;
	Vector() {}
	Vector(int x, int y) : x(x), y(y) {}
	Vector(Point a, Point b)
	{
		x = b.x - a.x;
		y = b.y - a.y;
	}
};

int n, q;

int d[MAXN], k[MAXN];

int x[MAXN], y[MAXN];

int u, sz;

vector <Point> v;

ll cp(Vector a, Vector b)
{
	return (ll)a.x * b.y - (ll)a.y * b.x;
}

void right(int xx, int yy)
{
	Point p(xx, yy);
	int id = xx + 1;
	Vector cur(0, 0);
	for (; id < sz; id++)
	{
		if (cp(cur, Vector(p, v[id])) >= 0)
			cur = Vector(p, v[id]);
		else
		{
			printf("%d\n", id - 1);
			return;
		}
	}
	printf("%d\n", sz - 1);
}

void left(int xx, int yy)
{
	Point p(xx, yy);
	int id = xx - 1;
	Vector cur(0, 0);
	for (; id >= 0; id--)
	{
		if (cp(cur, Vector(p, v[id])) <= 0)
			cur = Vector(p, v[id]);
		else
		{
			printf("%d ", id + 1);
			return;
		}
	}
	printf("%d ", 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++)
	{
		scanf("%d %d", &d[i], &k[i]);
		x[i] = x[i - 1] + d[i];
		y[i] = y[i - 1] + k[i] * d[i];
	}
	v.push_back(Point(0, 0));
	int yy = 0;
	for (int xx = 1; xx <= x[0]; xx++)
	{
		yy += k[0];
		v.push_back(Point(xx, yy));
	}
	for (int i = 1; i < n; i++)
	{
		int yy = y[i - 1];
		for (int xx = x[i - 1] + 1; xx <= x[i]; xx++)
		{
			yy += k[i];
			v.push_back(Point(xx, yy));
		}
	}
	sz = v.size();
	for (int i = 0; i < q; i++)
	{
		int u, v;
		scanf("%d %d", &u, &v);
		left(u, v);
		right(u, v);
	}
	return 0;
}