Problem: Today the North Pole hosts an Olympiad in a sport called... toy igloo skyscrapers' building!

There are n walruses taking part in the contest. Each walrus is given a unique number from 1 to n. After start each walrus begins to build his own igloo skyscraper. Initially, at the moment of time equal to 0, the height of the skyscraper i-th walrus is equal to ai. Each minute the i-th walrus finishes building bi floors.

The journalists that are reporting from the spot where the Olympiad is taking place, make q queries to the organizers. Each query is characterized by a group of three numbers li, ri, ti. The organizers respond to each query with a number x, such that:

1. Number x lies on the interval from li to ri inclusive (li ≤ x ≤ ri).

2. The skyscraper of the walrus number x possesses the maximum height among the skyscrapers of all walruses from the interval [li, ri] at the moment of time ti.

For each journalists' query print the number of the walrus x that meets the above-given criteria. If there are several possible answers, print any of them.

Input

The first line contains numbers n and q (1 ≤ n, q ≤ 105). Next n lines contain pairs of numbers ai, bi (1 ≤ ai, bi ≤ 109). Then follow q queries i the following format li, ri, ti, one per each line (1 ≤ li ≤ ri ≤ n, 0 ≤ ti ≤ 106). All input numbers are integers.

Output

For each journalists' query print the number of the walrus x that meets the criteria, given in the statement. Print one number per line.

Examples

Input

5 4
4 1
3 5
6 2
3 5
6 5
1 5 2
1 3 5
1 1 0
1 5 0


Output

5
2
1
5


Input

5 4
6 1
5 1
2 5
4 3
6 1
2 4 1
3 4 5
1 4 5
1 2 0


Output

3
3
3
1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
T BigMod(T b, T p, T m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    T s = BigMod(b, p / 2, m);
    return ((s % m) * (s % m)) % m;
  }
  return ((b % m) * (BigMod(b, p - 1, m) % m)) % m;
}
template <typename T>
T ModInv(T b, T m) {
  return BigMod(b, m - 2, m);
}
template <typename T>
T in() {
  char ch;
  T n = 0;
  bool ng = false;
  while (1) {
    ch = getchar();
    if (ch == '-') {
      ng = true;
      ch = getchar();
      break;
    }
    if (ch >= '0' && ch <= '9') break;
  }
  while (1) {
    n = n * 10 + (ch - '0');
    ch = getchar();
    if (ch < '0' || ch > '9') break;
  }
  return (ng ? -n : n);
}
template <typename T>
T POW(T B, T printf) {
  if (printf == 0) return 1;
  if (printf & 1)
    return B * POW(B, printf - 1);
  else
    return (POW(B, printf / 2) * POW(B, printf / 2));
}
template <typename T>
T Bigmod(T b, T p, T m) {
  if (p == 0)
    return 1;
  else if (!(p & 1))
    return (Bigmod(b, p / 2, m) * Bigmod(b, p / 2, m)) % m;
  else
    return ((b % m) * Bigmod(b, p - 1, m)) % m;
}
template <typename T>
T Dis(T x1, T y1, T x2, T y2) {
  return sqrt((x1 - x2 * x1 - x2) + (y1 - y2 * y1 - y2));
}
template <typename T>
T Angle(T x1, T y1, T x2, T y2) {
  return atan(double(y1 - y2) / double(x1 - x2));
}
template <typename T>
T DIFF(T a, T b) {
  T d = a - b;
  if (d < 0)
    return -d;
  else
    return d;
}
template <typename T>
T ABS(T a) {
  if (a < 0)
    return -a;
  else
    return a;
}
template <typename T>
T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
template <typename T>
T euclide(T a, T b, T &x, T &y) {
  if (a < 0) {
    T d = euclide(-a, b, x, y);
    x = -x;
    return d;
  }
  if (b < 0) {
    T d = euclide(a, -b, x, y);
    y = -y;
    return d;
  }
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  } else {
    T d = euclide(b, a % b, x, y);
    T t = x;
    x = y;
    y = t - (a / b) * y;
    return d;
  }
}
template <typename T>
void ia(T a[], int n) {
  for (int i = 0; i < n; i++) cin >> a[i];
}
template <typename T>
void pa(T a[], int n) {
  for (int i = 0; i < n - 1; i++) cout << a[i] << " ";
  cout << a[n - 1] << endl;
}
template <typename T>
long long int isLeft(T a, T b, T c) {
  return (a.x - b.x) * (b.y - c.y) - (b.x - c.x) * (a.y - b.y);
}
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
bool Check(int N, int pos) { return (bool)(N & (1 << pos)); }
template <class T, class first>
inline T togglebit(T a, first i) {
  T t = 1;
  return (a ^ (t << i));
}
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int toLlint(string s) {
  long long int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int cdigittoint(char ch) { return ch - '0'; }
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
bool isConst(char ch) {
  if (isalpha(ch) && !isVowel(ch)) return true;
  return false;
}
double DEG(double x) { return (180.0 * x) / (2.0 * acos(0.0)); }
double RAD(double x) { return (x * (double)2.0 * acos(0.0)) / (180.0); }
struct Line {
  long long int m, c, id;
  Line() {}
  Line(long long int _m, long long int _c, long long int _id) {
    m = _m;
    c = _c;
    id = _id;
  }
  bool operator<(const Line &p) const {
    if (m > p.m) return true;
    if (m == p.m) {
      if (c > p.c) return true;
    }
    return false;
  }
};
Line Tree[21][100007];
Line Stck[21][100007];
int Len[21][100007];
Line a[100007];
int debug;
double SecPoint(Line a, Line b) {
  return ((double)(b.c - a.c)) / ((double)(a.m - b.m));
}
void Build(int lvl, int l, int r) {
  if (l == r) {
    Tree[lvl][l] = a[l];
    Stck[lvl][l] = a[l];
    Len[lvl][l] = l;
    return;
  }
  Build(lvl + 1, l, ((l + r) >> 1));
  Build(lvl + 1, ((l + r) >> 1) + 1, r);
  int id1 = l, id2 = ((l + r) >> 1) + 1;
  int id = l;
  while (id1 <= ((l + r) >> 1) && id2 <= r) {
    if (Tree[lvl + 1][id1] < Tree[lvl + 1][id2])
      Tree[lvl][id++] = Tree[lvl + 1][id1++];
    else
      Tree[lvl][id++] = Tree[lvl + 1][id2++];
  }
  while (id1 <= ((l + r) >> 1)) Tree[lvl][id++] = Tree[lvl + 1][id1++];
  while (id2 <= r) Tree[lvl][id++] = Tree[lvl + 1][id2++];
  int &top = Len[lvl][l];
  top = l - 1;
  for (int i = l; i <= r; i++) {
    if (i > l && Tree[lvl][i].m == Tree[lvl][i - 1].m) continue;
    while (top - (l - 1) > 1 &&
           SecPoint(Stck[lvl][top - 1], Tree[lvl][i]) >
               SecPoint(Stck[lvl][top - 1], Stck[lvl][top]))
      top--;
    Stck[lvl][++top] = Tree[lvl][i];
  }
}
long long int BSearch(int lvl, int s, int e, long long int x) {
  int lw = s, hg = e;
  while (lw <= hg) {
    int md = (lw + hg) >> 1;
    double st = -1e18, ed = 1e18;
    if (md != s) ed = SecPoint(Stck[lvl][md - 1], Stck[lvl][md]);
    if (md != e) st = SecPoint(Stck[lvl][md], Stck[lvl][md + 1]);
    if (st <= x && x <= ed)
      return Stck[lvl][md].id;
    else if (x < st)
      lw = md + 1;
    else if (x > ed)
      hg = md - 1;
  }
}
long long int Query(int lvl, int l, int r, int s, int e, long long int x) {
  if (s == l && e == r) return BSearch(lvl, l, Len[lvl][l], x);
  if (e <= ((l + r) >> 1))
    return Query(lvl + 1, l, ((l + r) >> 1), s, e, x);
  else if (s > ((l + r) >> 1))
    return Query(lvl + 1, ((l + r) >> 1) + 1, r, s, e, x);
  else {
    long long int q1 = Query(lvl + 1, l, ((l + r) >> 1), s, ((l + r) >> 1), x);
    long long int q2 =
        Query(lvl + 1, ((l + r) >> 1) + 1, r, ((l + r) >> 1) + 1, e, x);
    if (a[q1].m * x + a[q1].c > a[q2].m * x + a[q2].c)
      return q1;
    else
      return q2;
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[i] = Line(y, x, i);
  }
  Build(1, 1, n);
  while (m--) {
    int l, r, x;
    scanf("%d%d%d", &l, &r, &x);
    printf("%lld\n", Query(1, 1, n, l, r, x));
  }
  return 0;
}