The main Bertown street is represented by a straight line. There are 109 bus stops located on the line. The stops are numbered with integers from 1 to 109 in the order in which they follow on the road. The city has n buses. Every day the i-th bus drives from stop number si to stop number fi (si < fi), it stops on all intermediate stops and returns only at night. The bus starts driving at time ti and drives so fast that it finishes driving also at time ti. The time ti is different for all buses. The buses have infinite capacity.

Bertown has m citizens. Today the i-th person should get from stop number li to stop number ri (li < ri); the i-th citizen comes to his initial stop (li) at time bi. Each person, on the one hand, wants to get to the destination point as quickly as possible, and on the other hand, definitely does not want to change the buses as he rides. More formally: the i-th person chooses bus j, with minimum time tj, such that sj ≤ li, ri ≤ fj and bi ≤ tj. 

Your task is to determine for each citizen whether he can ride to the destination point today and if he can, find the number of the bus on which the citizen will ride.

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 105) — the number of buses and the number of people. 

Then n lines follow, each of them contains three integers: si, fi, ti (1 ≤ si, fi, ti ≤ 109, si < fi) — the description of the buses. It is guaranteed that all ti-s are different.

Then m lines follow, each of them contains three integers: li, ri, bi (1 ≤ li, ri, bi ≤ 109, li < ri) — the Bertown citizens' description. Some bi-s could coincide.

Output

In the first line print m space-separated integers: the i-th number should be equal either to -1, if the person number i can't get to the destination point, or to the number of the bus that will ride the person number i. The buses are numbered with integers from 1 to n in the input order.

Examples

Input

4 3
1 10 10
5 6 2
6 7 3
5 7 4
5 7 1
1 2 1
1 10 11


Output

4 1 -1


Input

1 1
1 1000000000 1000000000
1 1000000000 1000000000


Output

1
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int b[maxn << 3];
int id[maxn << 3];
int n, m;
struct seg {
  int l, r, t, id;
};
vector<int> val;
int pos(int x) {
  return lower_bound(val.begin(), val.end(), x) - val.begin() + 1;
}
void build(int o, int l, int r) {
  if (r == l) {
    b[o] = -1e9;
    return;
  }
  build((o * 2), l, ((l + r) >> 1));
  build((o * 2 + 1), ((l + r) >> 1) + 1, r);
  b[o] = max(b[(o * 2)], b[(o * 2 + 1)]);
}
void A(int o, int l, int r, int qd, int d1, int d2) {
  if (r == l) {
    b[o] = d1;
    id[o] = d2;
    return;
  }
  if (qd <= ((l + r) >> 1))
    A((o * 2), l, ((l + r) >> 1), qd, d1, d2);
  else
    A((o * 2 + 1), ((l + r) >> 1) + 1, r, qd, d1, d2);
  b[o] = max(b[(o * 2)], b[(o * 2 + 1)]);
}
int Q(int o, int l, int r, int qd, int d) {
  if (b[o] < d) return -1;
  int ans;
  if (r == l) {
    return id[o];
  }
  if (qd <= ((l + r) >> 1)) {
    ans = Q((o * 2), l, ((l + r) >> 1), qd, d);
    if (ans != -1) return ans;
  }
  return Q((o * 2 + 1), ((l + r) >> 1) + 1, r, qd, d);
}
int ans[maxn];
int main() {
  scanf("%d%d", &n, &m);
  vector<seg> v;
  for (int i = 1; i <= n + m; ++i) {
    int l, r, t;
    scanf("%d%d%d", &l, &r, &t);
    v.push_back({l, r, t, i});
    val.push_back(t);
  }
  sort(val.begin(), val.end());
  val.resize(unique(val.begin(), val.end()) - val.begin());
  sort(v.begin(), v.end(), [](const seg& a, const seg& b) {
    if (a.l == b.l) return a.id < b.id;
    return a.l < b.l;
  });
  build(1, 1, val.size());
  for (int i = 0; i < v.size(); ++i) {
    if (v[i].id <= n) {
      A(1, 1, val.size(), pos(v[i].t), v[i].r, v[i].id);
    } else {
      ans[v[i].id - n] = Q(1, 1, val.size(), pos(v[i].t), v[i].r);
    }
  }
  for (int i = 1; i <= m; ++i) printf("%d%c", ans[i], " \n"[i == n]);
}
