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 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>
inline T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return (POW(B, P / 2) * POW(B, P / 2));
}
template <typename T>
inline 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>
inline 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));
}
long long Bigmod(long long base, long long power, long long MOD) {
  long long ret = 1;
  while (power) {
    if (power & 1) ret = (ret * base) % MOD;
    base = (base * base) % MOD;
    power >>= 1;
  }
  return ret;
}
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
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);
}
long long ModInverse(long long number, long long MOD) {
  return Bigmod(number, MOD - 2, MOD);
}
bool isConst(char ch) {
  if (isalpha(ch) && !isVowel(ch)) return true;
  return false;
}
int toInt(string s) {
  int sm;
  stringstream second(s);
  second >> sm;
  return sm;
}
struct CHT {
  vector<long long int> Slope, Ci, Id;
  int Isbad(int l1, int l2, int l3) {
    return 1.0 * (Ci[l3] - Ci[l1]) * (Slope[l1] - Slope[l2]) <=
           1.0 * (Ci[l2] - Ci[l1]) * (Slope[l1] - Slope[l3]);
  }
  void Add(long long int m, long long int c, int id) {
    Slope.push_back(m);
    Ci.push_back(c);
    Id.push_back(id);
    while (Slope.size() >= 3 &&
           Isbad(Slope.size() - 3, Slope.size() - 2, Slope.size() - 1)) {
      Slope.erase(Slope.end() - 2);
      Ci.erase(Ci.end() - 2);
      Id.erase(Id.end() - 2);
    }
  }
  long long int Query(int nw, long long int x) {
    return (Slope[nw] * x + Ci[nw]);
  }
  long long int GetMin(long long int x) {
    int l = -1, r = Slope.size() - 1;
    while ((r - l) > 1) {
      int m = (l + r) / 2;
      if (Query(m, x) >= Query(m + 1, x))
        l = m;
      else
        r = m;
    }
    return Query(r, x);
  }
  pair<long long int, int> GetMax(long long int x) {
    int l = -1, r = Slope.size() - 1;
    while ((r - l) > 1) {
      int m = (l + r) / 2;
      if (Query(m, x) <= Query(m + 1, x))
        l = m;
      else
        r = m;
    }
    return make_pair(Query(r, x), Id[r]);
  }
};
CHT Tree[200007 * 4];
void Merge(int id, int lf, int rg) {
  int l = 0, r = 0;
  int lln = Tree[lf].Slope.size(), rln = Tree[rg].Slope.size();
  while (l < lln && r < rln) {
    if (Tree[lf].Slope[l] < Tree[rg].Slope[r]) {
      Tree[id].Add(Tree[lf].Slope[l], Tree[lf].Ci[l], Tree[lf].Id[l]);
      l++;
    } else {
      Tree[id].Add(Tree[rg].Slope[r], Tree[rg].Ci[r], Tree[rg].Id[r]);
      r++;
    }
  }
  while (l < lln) {
    Tree[id].Add(Tree[lf].Slope[l], Tree[lf].Ci[l], Tree[lf].Id[l]);
    l++;
  }
  while (r < rln) {
    Tree[id].Add(Tree[rg].Slope[r], Tree[rg].Ci[r], Tree[rg].Id[r]);
    r++;
  }
  return;
}
int a[200007];
int b[200007];
void Upd(int id, int l, int r) {
  if (l == r) {
    Tree[id].Add(b[l], a[l], l);
    return;
  }
  int mid = (l + r) / 2;
  int lft = 2 * id;
  int rgt = lft + 1;
  Upd(lft, l, mid);
  Upd(rgt, mid + 1, r);
  Merge(id, lft, rgt);
}
long long int P;
pair<long long int, int> Qry(int id, int l, int r, int s, int e) {
  if (s <= l && e >= r) {
    return Tree[id].GetMax(P);
  }
  int mid = (l + r) / 2;
  int lft = 2 * id;
  int rgt = lft + 1;
  if (e <= mid)
    return Qry(lft, l, mid, s, e);
  else if (s > mid)
    return Qry(rgt, mid + 1, r, s, e);
  else {
    pair<long long int, int> lf = Qry(lft, l, mid, s, e);
    pair<long long int, int> rg = Qry(rgt, mid + 1, r, s, e);
    if (lf.first >= rg.first) return lf;
    return rg;
  }
}
int main() {
  int n, m;
  n = in<int>(), m = in<int>();
  for (int i = 1; i < n + 1; i++) {
    a[i] = in<int>(), b[i] = in<int>();
  }
  Upd(1, 1, n);
  while (m--) {
    int l, r;
    l = in<int>(), r = in<int>();
    P = in<long long int>();
    printf("%d\n", Qry(1, 1, n, l, r).second);
  }
  return 0;
}