#include <bits/stdc++.h>
using namespace std;
typedef struct node_t {
  int l, r, k, id;
  friend bool operator<(const node_t& a, const node_t& b) {
    if (a.r == b.r) return a.l > b.l;
    return a.r < b.r;
  }
  void print() { printf("l = %d, r = %d, k = %d, id = %d\n", l, r, k, id); }
} node_t;
const int maxn = 1e5 + 5;
node_t Q[maxn], P[maxn];
int ans[maxn];
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d %d", &Q[i].l, &Q[i].r);
    Q[i].id = i;
  }
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d %d %d", &P[i].l, &P[i].r, &P[i].k);
    P[i].id = i + 1;
  }
  sort(Q, Q + n);
  sort(P, P + m);
  set<pair<int, int> > st;
  set<pair<int, int> >::iterator iter, titer;
  int i, j, k;
  i = 0;
  for (j = 0; j < m; ++j) {
    while (i < n && Q[i].r <= P[j].r) {
      st.insert(make_pair(Q[i].l, Q[i].id));
      ++i;
    }
    iter = st.lower_bound(make_pair(P[j].l, -1));
    while (iter != st.end() && P[j].k-- > 0) {
      ans[iter->second] = P[j].id;
      titer = iter;
      iter++;
      st.erase(titer);
    }
  }
  if (i < n || st.size() > 0) {
    puts("NO");
  } else {
    puts("YES");
    for (int i = 0; i < n; ++i) {
      printf("%d ", ans[i]);
    }
    putchar('\n');
  }
  return 0;
}
