

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class D {
	public static StringTokenizer st;
	public static BufferedReader in;
	public static PrintWriter out;
	public static String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}
	public static int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}
	public static class Query implements Comparable<Query> {
		public final int h, i;
		
		public Query(int h, int i) {
			this.h = h;
			this.i = i;
		}

		@Override
		public int compareTo(Query o) {
			return Integer.compare(h, o.h);
		}
		
	}
	public static void main(String[] args) throws IOException {
		boolean test = false;
		String fileName = "mountain";
		if (test) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader(fileName + ".in"));
			out = new PrintWriter(fileName + ".out");
		}
		int n = nextInt();
		int q = nextInt();
		int[] x = new int[n + 1];
		int[] y = new int[n + 1];
		int[] k = new int[n];
		boolean fifth = true;
		int[] qx = new int[q], qy = new int[q];
		for (int i = 1; i <= n; i++) {
			int dx = nextInt();
			k[i - 1] = nextInt();
			int dy = dx * k[i - 1];
			x[i] = x[i - 1] + dx;
			y[i] = y[i - 1] + dy;
		}
		for (int i = 0; i < q; i++) {
			qx[i] = nextInt();
			qy[i] = nextInt();
			if (qx[i] != qx[0]) {
				fifth = false;
			}
		}
		if (fifth) {
			Query[] qs = new Query[q];
			for (int i = 0; i < q; i++) {
				qs[i] = new Query(qy[i], i);
			}
			int[] ansl = new int[q];
			int[] ansr = new int[q];
			Arrays.sort(qs);
			int qxx = qx[0];
			int j = Arrays.binarySearch(x, qxx);
			int spl = j < 0 ? -j - 2 : j - 1;
			int spr = j < 0 ? -j - 1 : j + 1;
			for (int i = 0; i < q; i++) {
				while (spl >= 0) {
					if (qs[i].h - y[spl] < k[spl] * (long) (qxx - x[spl])) {
						break;
					}
					spl--;
				}
				spl++;
				while (spr <= n) {
					if (y[spr] - qs[i].h > k[spr - 1] * (long) (x[spr] - qxx)) {
						break;
					}
					spr++;
				}
				spr--;
				ansl[qs[i].i] = spl;
				ansr[qs[i].i] = spr;
			}
			for (int i = 0; i < q; i++) {
				out.println(ansl[i] + " " + ansr[i]);
			}
			in.close();
			out.close();
			return;
		}
		for (int i = 0; i < q; i++) {
			int j = Arrays.binarySearch(x, qx[i]);
			int spl = j < 0 ? -j - 2 : j - 1;
			int spr = j < 0 ? -j - 1 : j + 1;
			while (spl >= 0) {
				if (qy[i] - y[spl] < k[spl] * (long) (qx[i] - x[spl])) {
					break;
				}
				spl--;
			}
			spl++;
			while (spr <= n) {
				if (y[spr] - qy[i] > k[spr - 1] * (long) (x[spr] - qx[i])) {
					break;
				}
				spr++;
			}
			spr--;
			out.println(x[spl] + " " + x[spr]);
		}
		in.close();
		out.close();
	}
}
/*
6 1
3 1
2 -1
1 1
1 -1
1 1
2 -1
5 3

5 3
1 1
1 -2
2 0
2 1
1 -1
3 0
3 5
3 3

6 4
1 2
2 -2
1 1
1 -2
4 1
1 -1
1 4
3 4
10 4
7 4

8 4
1 -3
2 0
1 1
2 0
1 -3
1 3
1 2
1 0
2 -2
6 -1
6 4
7 -4

 */
