import java.io.*;
import java.util.*;

public class Pr4Mountain {
	public static void main(String[] args) throws IOException {
		new Pr4Mountain().run();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	void run() throws IOException {
		in = new BufferedReader(new FileReader("mountain.in"));
		out = new PrintWriter("mountain.out");
		solve();
		out.flush();
	}

	class Point {
		long x;
		long y;

		public Point() {
		}

		public Point(long x, long y) {
			this.x = x;
			this.y = y;
		}
	}

	void solve() throws IOException {
		int n = nextInt();
		int q = nextInt();
		Point[] all = new Point[n + 1];
		all[0] = new Point();
		for (int i = 1; i <= n; i++) {
			long d = nextInt();
			long k = nextInt();
			all[i] = new Point(all[i - 1].x + d, all[i - 1].y + d * k);
		}
//		for(int i = 0; i < n; i++) {
//			System.out.println(all[i].x + " " + all[i].y);
//		}
		for (; q > 0; q--) {
			int u = nextInt();
			int v = nextInt();
			int l = 0;
			int r = 0;
			for (int i = 0; i <= n; i++) {
				if (all[i].x == u) {
					l = i;
					r = i;
					break;
				}
				if (i == 0 && u < all[i].x) {
					l = i;
					r = i;
					break;
				}
				if (n == i && all[i].x < u) {
					l = i;
					r = i;
					break;
				}
				if (i > 0 && all[i].x > u && all[i - 1].x < u) {
					l = i - 1;
					r = i;
					break;
				}
			}
			double mink = Double.POSITIVE_INFINITY;
			if(u != all[l].x) {
				mink = (v - all[l].y) * 1.0 / (u - all[l].x);
			}
			// int wh = l;
			while (l > 0) {
				if ((v - all[l - 1].y) * 1.0 / (u - all[l - 1].x) <= mink) {
					mink = (v - all[l - 1].y) * 1.0 / (u - all[l - 1].x);
					l--;
				} else {
					break;
				}
			}
			double maxk = Double.NEGATIVE_INFINITY;
			if(u != all[r].x) {
				maxk = (all[r].y - v) * 1.0 / (all[r].x - u);
			}
			while (r < n) {
				if ((all[r + 1].y - v) * 1.0 / (all[r + 1].x - u) >= maxk) {
					maxk = (all[r + 1].y - v) * 1.0 / (all[r + 1].x - u);
					r++;
				} else {
					break;
				}
			}
			out.println(all[l].x + " " + all[r].x);
		}
	}
}
