#include <bits/stdc++.h>
using namespace std;
using LL = long long;
struct Edge {
  int i, u, v, n;
  Edge(int j = 0, int a = 0, int b = 0, int c = 0) : i(j), u(a), v(b), n(c) {}
  bool operator<(const Edge &e) const {
    if (v == e.v) return u < e.u;
    return v < e.v;
  }
};
struct Node {
  int i, u, v;
  Node(int j = 0, int x = 0, int y = 0) : i(j), u(x), v(y) {}
  bool operator<(const Node &n) const {
    if (u == n.u) {
      if (v == n.v) return i < n.i;
      return v < n.v;
    }
    return u < n.u;
  }
};
int g_sn;
int g_pn;
vector<Edge> ve_s;
vector<Edge> ve_p;
set<Node> sn;
map<int, int> mii_ans;
bool input() {
  cin >> g_sn;
  if (cin.eof()) return false;
  ve_s.clear();
  ve_p.clear();
  sn.clear();
  mii_ans.clear();
  int u, v;
  for (int i = 0; i < g_sn; ++i) {
    scanf("%d%d", &u, &v);
    ve_s.emplace_back(i + 1, u, v);
  }
  cin >> g_pn;
  int n;
  for (int i = 0; i < g_pn; ++i) {
    scanf("%d%d%d", &u, &v, &n);
    ve_p.emplace_back(i + 1, u, v, n);
  }
  return true;
}
void solve() {
  sort(ve_s.begin(), ve_s.end());
  sort(ve_p.begin(), ve_p.end());
  int cnt = g_sn;
  for (int i = 0, j = 0; i < g_pn; ++i) {
    auto &p = ve_p[i];
    while (j < g_sn && ve_s[j].v <= p.v) {
      auto &s = ve_s[j];
      sn.emplace(s.i, s.u, s.v);
      ++j;
    }
    while (p.n != 0) {
      auto mst = sn.lower_bound(Node(0, p.u, 0));
      if (mst == sn.end()) break;
      mii_ans.emplace((*mst).i, p.i);
      --p.n;
      sn.erase(mst);
      --cnt;
    }
  }
  if (!sn.empty() || cnt != 0) {
    puts("NO");
    return;
  }
  puts("YES");
  printf("%d", mii_ans[1]);
  for (int i = 2; i <= g_sn; ++i) printf(" %d", mii_ans[i]);
  puts("");
}
int main() {
  while (input()) {
    solve();
  }
  return 0;
}
