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

public class Mountain {
    String fileName = "mountain";

    public void solve() throws IOException {
        int n = nextInt(), q = nextInt();
        Segment[] seg = new Segment[n];
        double x = 0, y = 0;
        for (int i = 0; i < n; i++) {
            seg[i] = new Segment(x, y, nextInt(), nextInt());
            x = seg[i].x2;
            y = seg[i].y2;
        }

        for (int i = 0; i < q; i++) {
            int u = nextInt(), v = nextInt();
            int t = 0;
            while (t < n && seg[t].x2 < u) {
                t++;
            }
            if (t == n) {
                throw new AssertionError();
            } else {
                int k = t - 1;
                while (k > -1 && (seg[k].k <= (v - seg[k].y2) / (u - seg[k].x2))) {
                    k--;
                }
                if (k == -1) {
                    out.print(0 + " ");
                } else {
                    out.print((int) seg[k].x2 + " ");
                }
                k = t + 1;
                while (k < n && (seg[k].k >= (seg[k].y1 - v) / (seg[k].x1 - u))) {
                    k++;
                }
                if (k == n) {
                    out.println((int) seg[n - 1].x2);
                } else {
                    out.println((int) seg[k].x1);
                }
            }
        }
    }

    private class Segment {
        double x1, y1, x2, y2;
        double d, k;

        public Segment(double x1, double y1, double d, double k) {
            this.x1 = x1;
            this.y1 = y1;
            this.d = d;
            this.k = k;
            x2 = x1 + d;
            y2 = y1 + d * k;
        }
    }

    public void run() {
        try {
            br = new BufferedReader(new FileReader(fileName + ".in"));
            out = new PrintWriter(fileName + ".out");

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

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

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

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new Mountain().run();
    }

}