#include <bits/stdc++.h>
using namespace std;
struct state {
  int l, r, id, can;
  state(int l, int r, int id, int can) : l(l), r(r), id(id), can(can) {}
  bool operator<(const state &e) const {
    if (e.r != r) return r < e.r;
    if (e.l != l) return e.l < l;
    return can < e.can;
  }
};
const int N = 1e5;
int n, m, sol[N];
vector<state> v;
set<pair<int, int> > st;
set<pair<int, int> >::iterator it;
int main() {
  scanf("%d", &n);
  int l, r, c;
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &l, &r);
    v.push_back(state(l, r, i, -1));
  }
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d%d%d", &l, &r, &c);
    v.push_back(state(l, r, i, c));
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < (int)v.size(); ++i) {
    if (v[i].can == -1) {
      st.insert(make_pair(v[i].l, v[i].id));
      continue;
    }
    int can = v[i].can;
    while (can != 0 && !st.empty()) {
      it = st.lower_bound(make_pair(v[i].l, -1));
      if (it == st.end()) break;
      sol[it->second] = v[i].id;
      st.erase(it);
      --can;
    }
  }
  if (st.empty()) {
    puts("YES");
    for (int i = 0; i < n; ++i) printf("%s%d", i ? " " : "", sol[i] + 1);
    puts("");
  } else
    puts("NO");
  return 0;
}
